<?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="ProjectPlanningTime" cacheable="true">
    
      <date name="date" column="date_val" title="Date" required="true" />  
      <decimal name="plannedHours" title="Planned hours" />
      
      <many-to-one name="user" ref="com.axelor.auth.db.User" title="User" column="user_id" required="true"/>
      <many-to-one name="project" ref="com.axelor.apps.project.db.Project" title="Project"  required="true"/>
      <many-to-one name="task" ref="com.axelor.team.db.TeamTask" title="Team task" />
      <integer name="timepercent" title="Time %" selection="project.task.progress.select"/>
      <string name="description" title="Description" large="true" />
      <many-to-one name="product" ref="com.axelor.apps.base.db.Product" title="Activity"/>
	  <boolean name="isIncludeInTurnoverForecast" title="Include in turnover forecast"/>
	  <time name="startTime" title="Start time"/>
	  <time name="endTime" title="End time"/>
	  
	  <string name="fullName" namecolumn="true">
			<![CDATA[
	  		String fullName = "";
	  		
	  		if(user != null && user.getName() != null)  {
				fullName += user.getName();
			}
			
			if (project != null && project.getCode() != null) {
				fullName += "-" + project.getCode();
			}
			
			String dateStr = date.format(java.time.format.DateTimeFormatter.ofPattern("dd/MM/yyyy"));
			if (!fullName.isEmpty()) {
				fullName += "-" + dateStr;
			}
			else {
				fullName = dateStr;
			}
			
	  		return fullName;
	  	]]>
	  </string>
	  
  </entity>
  
</domain-models>