<?xml version="1.0" encoding="UTF-8"?>
<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="base" package="com.axelor.apps.base.db"/>

  <entity name="Year" lang="java" cacheable="true">

    <string name="name" title="Name" required="true"/>
    <string name="code" title="Code" required="true"/>
    <date name="fromDate" title="From" required="true"/>
    <date name="toDate" title="To" required="true"/>
    <one-to-many name="periodList" ref="com.axelor.apps.base.db.Period" mappedBy="year" title="Periods list"/>
    <many-to-one name="company" ref="com.axelor.apps.base.db.Company" title="Company"/>
	<integer name="statusSelect" title="Status" readonly="true" selection="base.year.status.select" default="1"/>
    <integer name="periodDurationSelect" title="Period duration" selection="account.year.period.duration.select"/>
    <integer name="typeSelect" title="Type" selection="account.year.type.select" required="true"/>
    <one-to-many name="adjustHistoryList" ref="com.axelor.apps.base.db.AdjustHistory" title="Adjust History" mappedBy="fiscalYear"/>

    <unique-constraint columns="code,company,typeSelect"/>
  	<extra-code><![CDATA[
	
	   	// STATUS SELECT
		public static final int STATUS_OPENED = 1;
		public static final int STATUS_CLOSED = 2;
		public static final int STATUS_ADJUSTING = 3;

		// TYPE SELECT
		public static final int TYPE_CIVIL = 0;
		public static final int TYPE_FISCAL = 1;
		public static final int TYPE_PAYROLL = 2;

	]]></extra-code>

  </entity>

</domain-models>
