<?xml version="1.0" ?>
<domain-models xmlns="http://axelor.com/xml/ns/domain-models"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://axelor.com/xml/ns/domain-models http://axelor.com/xml/ns/domain-models/domain-models_5.2.xsd">

  <module name="project" package="com.axelor.apps.project.db"/>

  <entity name="Project">

		<string name="name"/>
		<string name="description" multiline="true" large="true"/>
		<many-to-one name="team" ref="com.axelor.team.db.Team"/>
		<many-to-many name="projectFolderSet" ref="com.axelor.apps.project.db.ProjectFolder" title="Project Folders"/>
		<one-to-many name="childProjectList" ref="com.axelor.apps.project.db.Project" title="Child Projects" mappedBy="parentProject"/>
		<many-to-one name="assignedTo" ref="com.axelor.auth.db.User" title="Assigned to"/>
		<integer name="statusSelect" selection="project.status.select" title="Status" default="1"/>
		<many-to-many name="teamTaskCategorySet" ref="com.axelor.apps.project.db.TeamTaskCategory" title="Type of authorized categories"/>
		<one-to-many name="teamTaskList" ref="com.axelor.team.db.TeamTask" title="Tasks" mappedBy="project"/>
		<boolean name="synchronize"/>
	  	<boolean name="extendsMembersFromParent" default="false"/>
		<many-to-one name="parentProject" ref="com.axelor.apps.project.db.Project" title="Parent project"/>
		<one-to-many name="wikiList" ref="com.axelor.apps.project.db.Wiki" title="Wiki" mappedBy="project"/>
		<one-to-many name="resourceBookingList" ref="com.axelor.apps.project.db.ResourceBooking" title="Resource booking" mappedBy="project"/>
		
		<string name="code" title="Code" unique="true"/>
		<many-to-many name="membersUserSet" ref="com.axelor.auth.db.User" title="Membres"/>
		<many-to-one name="clientPartner" ref="com.axelor.apps.base.db.Partner" title="Customer"/>
		<many-to-one name="contactPartner" ref="com.axelor.apps.base.db.Partner" title="Customer Contact"/>
		
		<datetime name="fromDate" title="From Date"/>
		<datetime name="toDate" title="To Date"/>
		<datetime name="dueDate" title="Due Date"/>
      
        <decimal name="estimatedTimeDays" title="Estimated time (in days)" />
        <decimal name="estimatedTimeHrs" title="Estimated time (in hours)" />
		
		<decimal name="timeSpent" title="Time Spent"/>
		
		<decimal name="progress" title="Progress (%)"/>
		<decimal name="sequence" title="Sequence" />
		<integer name="orderByState"/>
	  
		<boolean name="imputable" default="true" massUpdate="true"/>
	  
		<many-to-many name="finishToStartTaskSet" ref="com.axelor.apps.project.db.Project" title="Finish tasks to start"/>
		<many-to-many name="startToStartTaskSet" ref="com.axelor.apps.project.db.Project" title="Start tasks to start"/>
		<many-to-many name="finishToFinishTaskSet" ref="com.axelor.apps.project.db.Project" title="Finish tasks to finish"/>
		<many-to-many name="startToFinishTaskSet" ref="com.axelor.apps.project.db.Project" title="Start tasks to finish"/>
		
		<many-to-one name="company" ref="com.axelor.apps.base.db.Company" title="Company"/>
		
		<many-to-many name="productSet" ref="com.axelor.apps.base.db.Product" title="Type of authorized activities"/>
		
		<boolean name="excludePlanning" title="Exclude planning" />
		
		<string name="fullName" namecolumn="true" title="Name"/>
	 	
	 	<boolean name="isProject" title="Project/Phase" default="true" />
	 	<boolean name="isShowPhasesElements" title="Show phases elements" default="true" />
	 	
        <integer name="projectTypeSelect" selection="project.project.project.type.select" default="1"/>
      	<enum name="genProjTypePerOrderLine" ref="GenProjTypePerOrderLine" default="BUSINESS_PROJECT"/>
      	
      	<finder-method name="findAllByParentProject" using="parentProject" all="true"/>
        <finder-method name="findByName" using="name"/>

	   <extra-code>
   		<![CDATA[
   			public static final Integer TYPE_PROJECT = 1;
   			public static final Integer TYPE_PHASE = 2;

   			public static final Integer STATE_NEW = 1;
   			public static final Integer STATE_IN_PROGRESS = 2;
   			public static final Integer STATE_FINISHED = 3;
   			public static final Integer STATE_CANCELED = 4;
   		]]>
   	</extra-code>
  </entity>

	<enum name="GenProjTypePerOrderLine">
		<item name="BUSINESS_PROJECT" title="Business project"/>
		<item name="PHASE_BY_LINE" title="Phase by line"/>
        <item name="TASK_BY_LINE" title="Task by line"/>
        <item name="PROJECT_ALONE" title="Project alone"/>
	</enum>
  
</domain-models>
