<?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="purchase" package="com.axelor.apps.purchase.db"/>

  <entity name="PurchaseOrderLine" lang="java">
  
  	<decimal name="amountInvoiced" title="Amount invoiced W.T." readonly="true"/>

  	<one-to-many name="analyticMoveLineList" ref="com.axelor.apps.account.db.AnalyticMoveLine" title="Analytic distribution lines" mappedBy="purchaseOrderLine"/>
	<many-to-one name="analyticDistributionTemplate" title="Analytic distribution template" ref="com.axelor.apps.account.db.AnalyticDistributionTemplate"/>
	
	<boolean name="invoiced" readonly="true"/>
	<many-to-one name="budget" ref="com.axelor.apps.account.db.Budget" title="Budget"/>
	<one-to-many name="budgetDistributionList" ref="com.axelor.apps.account.db.BudgetDistribution" title="Budget Distribution" mappedBy="purchaseOrderLine"/>
	<decimal name="budgetDistributionSumAmount" title="Total amount attributed"/>
	
	<integer name="receiptState" title="Receipt state" selection="purchase.order.receipt.state" readonly="true" default="0"/>

	<extra-code>
  		<![CDATA[
	  		
	        // RECEIPT STATE SELECT
            public static final int RECEIPT_STATE_NOT_RECEIVED = 1;
            public static final int RECEIPT_STATE_PARTIALLY_RECEIVED = 2;
            public static final int RECEIPT_STATE_RECEIVED = 3;
	  	]]>
  	</extra-code>
  	
  </entity>

</domain-models>
