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

  <entity name="StockProductionRequestLine" lang="java">
    <many-to-one name="stockProductionRequest" readonly="true" ref="com.axelor.apps.stock.db.StockProductionRequest" title="Stock Production Request"/>
    <many-to-one name="product" ref="com.axelor.apps.base.db.Product" title="Product"/>
    <decimal name="realQty" min="0" title="Real Qty"/>
    <many-to-one name="unit" ref="com.axelor.apps.base.db.Unit" title="Unit"/>
    <string name="productName" title="Title" required="true" namecolumn="true" />
    <string name="description" title="Description" large="true"/>
    <decimal name="unitPriceUntaxed" precision="20" scale="10" title="Unit price"/>
    <decimal name="unitPriceTaxed" precision="20" scale="10" title="Unit price"/>   
    <decimal name="companyUnitPriceUntaxed" precision="20" scale="10" title="Company Unit price W.T."/>
    <decimal name="wapPrice" precision="20" scale="10" readonly="true" nullable="true" title="Price used for WAP"/>
    <integer name="sequence" title="Seq."/>
    <boolean name="isWapUpdated" title="Is wap upadted"/>
    <boolean name="justifiedGap" title="Justified gap"/>
	  <decimal name="totalQty" min="0" title="Total Qty"/>  
    <decimal name="currencyRate" title="Currency Rate" scale="6" precision="20" />
    <decimal name="convertedExTaxTotal" title="Converted ExTaxTotal" scale="6" precision="20" />
		<decimal name="convertedInTaxTotal" title="Converted InTaxTotal" scale="6" precision="20" />

    <integer name="deliveryState" title="Delivery State" selection="sale.order.delivery.state" readonly="true" default="1"/>
    <boolean name="isWithBackorder" title="Manage backorder" default="true"/>
    <many-to-one name="trackingNumber" ref="com.axelor.apps.stock.db.TrackingNumber" title="Tracking Nbr."/>

    <extra-code><![CDATA[
        // CONFORMITY SELECT
        public static final int CONFORMITY_NONE = 1;
        public static final int CONFORMITY_COMPLIANT = 2;
        public static final int CONFORMITY_NON_COMPLIANT = 3;
        
        // AVAILABLE STATUS SELECT
        public static final int STATUS_AVAILABLE = 1;
        public static final int STATUS_AVAILABLE_FOR_PRODUCT = 2;
        public static final int STATUS_MISSING = 3;


        // DELIVERY STATE SELECT
        public static final int DELIVERY_STATE_NOT_DELIVERED = 1;
        public static final int DELIVERY_STATE_PARTIALLY_DELIVERED = 2;
        public static final int DELIVERY_STATE_DELIVERED = 3;

        ]]></extra-code>
    
    <track>
    	<field name="realQty"/>
    	<field name="unitPriceUntaxed"/>
    </track>
  </entity>

</domain-models>
