<?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="StockMove" lang="java">
  
    <!-- Onglet Configuration -->
    <many-to-many name="invoiceSet" ref="com.axelor.apps.account.db.Invoice" title="Invoice"  mappedBy="stockMoveSet"/>
    <string name="specificPackage" large="true"/>

    <datetime name="reservationDateTime" readonly="true"/>
    
   	<many-to-many name="batchSet" ref="com.axelor.apps.base.db.Batch" title="Batchs"/>
   	<string name="deliveryCondition" title="Delivery conditions" large="true" multiline="true"/>
   	
    <integer name="pfpValidateStatusSelect" title="PFP Status" selection="invoice.pfp.validate.status.select" readonly="true" default="1"/>

    <many-to-one ref="com.axelor.apps.purchase.db.PurchaseRequest" name="purchaseRequest"  title="Purchase request"/>

    <many-to-one name="analyticAccount" ref="com.axelor.apps.account.db.AnalyticAccount" title="Analytic Acc."/>

    <many-to-one name="analyticAxis" ref="com.axelor.apps.account.db.AnalyticAxis" title="Analytic axis" /> 

    <many-to-many name="purchaseRequestSet" ref="com.axelor.apps.purchase.db.PurchaseRequest" title="Purchase requests"/>

    <finder-method name="findAllBySaleOrderAndStatus" using="originTypeSelect,originId,statusSelect" all="true"/>

    <extra-code>
    <![CDATA[
		public static final String ORIGIN_SALE_ORDER = "com.axelor.apps.sale.db.SaleOrder";
		public static final String ORIGIN_PURCHASE_ORDER = "com.axelor.apps.purchase.db.PurchaseOrder";
		
		// INVOICE
	    public static final int INVOICE_ALL = 1;
	    public static final int INVOICE_PARTILLY = 2;
    ]]>
    </extra-code>

    <track on="UPDATE">
		<field name="pfpValidateStatusSelect"/>
      <field name="invoiceSet"/>
    </track>

  </entity>
</domain-models>
