<?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"/>

	<sequence name="importation.seq" initial="1" increment="1" padding="5" prefix="DOSIMP"/>

	<entity name="ImportationFolder" sequential="true" lang="java">
		<string name="name" sequence="importation.seq" title="Ref."/>
		<integer name="statusSelect" selection="purchase.importation.folder.status.select" readonly="true" default="1" />
		<one-to-many name="purchaseOrderList" ref="PurchaseOrder" mappedBy="importationFolder" title="Purchase order"/>
		<one-to-many name="purchaseOrderLineList" ref="PurchaseOrderLine" title="Purchase order line"/>
		<many-to-one name="forwardingPartner" ref="com.axelor.apps.base.db.Partner" title="Forwarding Partner"/>
		<many-to-one name="supplierPartner" ref="com.axelor.apps.base.db.Partner" title="Supplier"/>
		<string name="containerNumber" title="Number Container."/>
		<!-- DATE D'EMBARQUEMENT -->
		<date name="boardingDate" title="Boarding date"/>
		<!-- reception sur site  -->
		<date name="arrivalGoodiDate" title="Arrival goods"/>
		<!-- reception sur site souhaite  -->
		<date name="requestedArrivalGoodiDate" title="Requested Arrival goods"/>
		<!-- date reception prevu -->
		<date name="EstimatedArrivalGoodiDate" title="Estimated Arrival goods"/>

		<date name="arrivalDocDate" title="Arrival Documents"/>
		<string name="noteArrivalDocDate" large="true" multiline="true" title="Arrival document note"/>


		<date name="invoiceDirectDebitDate" title="Invoice direct debit"/>
		<date name="folderReceptionDate" title="Folder reception date"/>
		<date name="arrivalNoticeDate" title="Arrival notice date"/>

		<many-to-one name="arrivalNoticeFile" ref="com.axelor.meta.db.MetaFile" title="Arrival notice file" />
		<one-to-many name="arrivalNoticeFiles" ref="com.axelor.meta.db.MetaFile" title="Arrival notice files" />


		<date name="d_10_date" title="Date D10"/>
		<many-to-one name="d10File" ref="com.axelor.meta.db.MetaFile" title="D10 File" />
		<one-to-many name="d10Files" ref="com.axelor.meta.db.MetaFile" title="D10 Files" />


		<many-to-one name="currency" ref="com.axelor.apps.base.db.Currency" title="Currency"/>
		<integer name="valorisation" title="Valorisation Type" selection="importation.folder.valorisation.type.select" />
		<integer name="progress" title="Progress %" min="0" max="100" />
		<integer name="orderByState"/>

		<decimal name="amount" precision="20" scale="4"/>
		<decimal name="taxAmount" precision="20" scale="4"/>
		<decimal name="totalAmount" precision="20" scale="2"/>

		<!-- Notes -->
		<string name="notes" large="true" multiline="true" title="Description To Display"/>
		<string name="internalNote" large="true" multiline="true" title="Internal Note"/>

		<!-- <many-to-one name="shipmentMode" ref="com.axelor.apps.stock.db.ShipmentMode"/> -->
		<!-- <many-to-one name="transportMode" ref="com.axelor.apps.stock.db.FreightCarrierMode" required="true" title="Transport Mode"/> -->

		<date name="transmissionPoToSupplier" title="Date transmission BC au fournisseur" />
		<string name="priority" selection="purchase.importation.folder.priority.select" default="1" />
		<string name="label" title="Label" />
		<!-- Date d'embarqument prevu -->
		<date name="estimdatedBoardingDate" title="Estimated boarding date" /> 
		<date name="liquidation_date" title="Liquidation date" />
		<date name="reception_sophal_date" title="Sophal Arrival" />
		<date name="reception_magasin_date" title="Store reception date" />
		<date name="transmission_dg_date" title="Date transmission a la DG" />

		<date name="delivery_date" title="Estimated delivery date" />

		<boolean name="reception_magasin_status" title="Store received statut" />

		<one-to-many name="importationDocumentList" ref="ImportationDocument" title="Information document" />
		<one-to-many name="importationCommentList" ref="com.axelor.apps.purchase.db.ImportationComment" mappedBy="importationFolder" title="Comments" />

		<date name="date_liquidation_invoice" title="Date liquidation facture" />
		<!-- facture fournisseur -->
		<many-to-one name="supplierInvoice" ref="com.axelor.meta.db.MetaFile" title="Supplier invoice" />

		<!-- numero document de transport -->
		<string name="lta_number" title="LTA" selection="purchase.importation.folder.lta.selection" />
		<many-to-one name="ltaFile" ref="com.axelor.meta.db.MetaFile" title="LTA file" />


		<string name="shipping_tracking_number" title="Shipping tracking number" />

		<!--enlevement  souhaite  -->
		<date name="requested_collection_date" title="Requested collection date" />
		<!--enlevement  prevu -->
		<date name="agreed_collection_date" title="Agreed collection date" />

		<!-- COA -->
		<many-to-one name="coaFile" ref="com.axelor.meta.db.MetaFile" title="coa file" />
		<string name="noteCOA" large="true" multiline="true" title="Comment on coa"/>

		<datetime name="coa_validation_date" title="Coa validation date" />

        <many-to-one name="coa_validator_user" ref="com.axelor.auth.db.User" />

		<string name="tracking_website" selection="purchase.importation.folder.website.selection" title="Tracking website" />

		<string name="file_type" selection="purchase.importation.folder.file.type" title="File type" />

		<many-to-many name="importationDocumentExtraList" ref="ImportationDocumentExtra" title="Information document extra" />

		<decimal name="CFR" title="CFR" />

		<decimal name="freight" title="Freight" />
		
		<decimal name="currencyRate" title="Currency Rate" scale="6" precision="20" />

		<boolean name="invoicedFolder" title="Invoiced folder" />

		<boolean name="rejected" default="false" title="Rejected" />
		<date name="rejectedDate" title="Rejected Date" />
		<many-to-one name="rejectedByUser" ref="com.axelor.auth.db.User" readonly="true" title="Rejected by"/> 
		<integer name="rejectedInstanceSelect" title="Status"  selection="purchase.importation.folder.status.select" />
		<string name="rejectionRaison" large="true"/>
		<many-to-one name="printingSettings" ref="com.axelor.apps.base.db.PrintingSettings"/>
		<!-- <many-to-one name="invoiceTemplate" ref="com.axelor.apps.account.db.InvoiceTemplate"/> -->
		
		<decimal name="demurrage" title="Demurrage " scale="6" precision="20" />
		<decimal name="storageCost" title="Storage cost " scale="6" precision="20" />
		<decimal name="cx" title="CX " scale="6" precision="20" />

		<extra-code>
			<![CDATA[
   		  /** Static importation folder status select */
		  public static final int STATUS_DRAFT = 1;
		  public static final int STATUS_OPEND = 2;
		  public static final int STATUS_CLOSED = 3;
		  public static final int STATUS_CANCELED = 4;	
		  public static final int STATUS_REJECTED = 9;	
		  public static final int STATUS_VALIDATED = 10;	
   		]]>
		</extra-code>


		<!-- end sophal -->
 		<track>
      		<field name="name"/>
      		<field name="statusSelect"/>
      	</track>

	</entity>

</domain-models>
