<?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="StockConfig" lang="java" cacheable="true">

    <one-to-one name="company" ref="com.axelor.apps.base.db.Company" title="Company" required="true" unique="true"/>

    <many-to-one name="receiptDefaultStockLocation" ref="com.axelor.apps.stock.db.StockLocation" title="Receipt default stock location"/>
    <many-to-one name="pickupDefaultStockLocation" ref="com.axelor.apps.stock.db.StockLocation" title="Pickup default stock location"/>
    <many-to-one name="qualityControlDefaultStockLocation" ref="com.axelor.apps.stock.db.StockLocation" title="Quality control default stock location"/>
    <many-to-one name="rawMaterialsDefaultStockLocation" ref="com.axelor.apps.stock.db.StockLocation" title="Raw materials default stock location"/>

   	<many-to-one name="customerVirtualStockLocation" ref="com.axelor.apps.stock.db.StockLocation" title="Customer virtual stock location"/>
    <many-to-one name="supplierVirtualStockLocation" ref="com.axelor.apps.stock.db.StockLocation" title="Supplier virtual stock location"/>
    <many-to-one name="inventoryVirtualStockLocation" ref="com.axelor.apps.stock.db.StockLocation" title="Inventory virtual stock location"/>

	<many-to-one name="customsMassUnit" ref="com.axelor.apps.base.db.Unit" title="Unit of mass"/>

    <boolean name="realizeStockMovesUponParcelPalletCollection" title="Realize stock moves upon parcel/pallet collection" />

    <boolean name="plannedStockMoveAutomaticMail" title="Send email when planning stock move" default="false"/>
    <boolean name="realStockMoveAutomaticMail" title="Send email on stock move realization" default="false"/>
    <many-to-one name="plannedStockMoveMessageTemplate" title="Message template" ref="com.axelor.apps.message.db.Template"/>
    <many-to-one name="realStockMoveMessageTemplate" title="Message template" ref="com.axelor.apps.message.db.Template"/>

    <boolean name="logisticalFormAutomaticEmail" title="Send email when saving logistical form" default="false"/>
    <many-to-one name="logisticalFormMessageTemplate" title="Message template" ref="com.axelor.apps.message.db.Template"/>

    <one-to-many name="freightCarrierCustomerAccountNumberList" ref="com.axelor.apps.stock.db.FreightCarrierCustomerAccountNumber" title="Customer account numbers to carriers" mappedBy="stockConfig"/>

    <string name="conformityCertificateTitle" title="Certificate of conformity title" translatable="true"/>
    <string name="conformityCertificateDescription" title="Text in certificate of conformity" large="true" translatable="true"/>
    <many-to-one name="signatoryUser" ref="com.axelor.auth.db.User" title="Default signatory user"/>
    
    <boolean name="displayTrackNbrOnPickingPrinting" title="Display tracking number details on Picking printing"/>
	<boolean name="displayBarcodeOnPickingPrinting" title="Display barcode on Picking printing"/>
    <boolean name="displayCustomerCodeOnPickingPrinting" title="Display customer code on picking printing"/>

	<boolean name="displayPartnerSeqOnPrinting" title="Display partner sequence on printing"/>
	
	<boolean name="displayLineDetailsOnPrinting" title="Display line details on printing"/>
	<boolean name="isWithReturnSurplus" title="Return Surplus"/>
	<boolean name="isWithBackorder" title="Manage backorder"/>
	
	<boolean name="pickingOrderPrintingDetailed" title="Picking order printing detailed"/>
	<boolean name="isDisplaySaleValueInPrinting" title="Display sale value in location financial data printing"/>
	<boolean name="isDisplayAccountingValueInPrinting" title="Display accounting value in location financial data printing"/>
	<boolean name="isDisplayAgPriceInPrinting" title="Display average price in printing"/>
	<integer name="stockValuationTypeSelect" title="Stock location value on form view" selection="stock.stock.location.value.type" />

	<boolean name="displayTrackNbrOnCertificateOfConformityPrinting" title="Display tracking number details on certificate of conformity printing"/>
	<boolean name="displayExtRefOnCertificateOfConformityPrinting" title="Display external ref. on certificate of conformity printing"/>
	<many-to-one name="stockRuleMessageTemplate" ref="com.axelor.apps.message.db.Template" title="Message template for stock rules"/>
	<one-to-many name="exludedProductsFromWrkFlw" ref="com.axelor.apps.base.db.Product" title="Excluded products from workflow (WMS)"/>

	<integer name="mpInternalSeq" title="MP internal sequence" />
	<integer name="acInternalSeq" title="AC internal sequence" />

	<track>
		<field name="company" on="UPDATE"/>
		
		<field name="receiptDefaultStockLocation" on="UPDATE"/>
		<field name="pickupDefaultStockLocation" on="UPDATE"/>
		<field name="qualityControlDefaultStockLocation" on="UPDATE"/>
		
		<field name="customerVirtualStockLocation" on="UPDATE"/>
		<field name="supplierVirtualStockLocation" on="UPDATE"/>
		<field name="inventoryVirtualStockLocation" on="UPDATE"/>
		
		<field name="customsMassUnit" on="UPDATE"/>
		
		<field name="realizeStockMovesUponParcelPalletCollection" on="UPDATE"/>
		
		<field name="plannedStockMoveAutomaticMail" on="UPDATE"/>
		<field name="realStockMoveAutomaticMail" on="UPDATE"/>
		<field name="plannedStockMoveMessageTemplate" on="UPDATE"/>
		<field name="realStockMoveMessageTemplate" on="UPDATE"/>
		
		<field name="conformityCertificateTitle" on="UPDATE"/>
		<field name="conformityCertificateDescription" on="UPDATE"/>
		<field name="signatoryUser" on="UPDATE"/>
		
		<field name="displayTrackNbrOnPickingPrinting" on="UPDATE"/>
		<field name="displayBarcodeOnPickingPrinting" on="UPDATE"/>
		<field name="displayCustomerCodeOnPickingPrinting" on="UPDATE"/>
		
		<field name="displayPartnerSeqOnPrinting" on="UPDATE"/>
		
		<field name="displayLineDetailsOnPrinting" on="UPDATE"/>
		<field name="isWithReturnSurplus" on="UPDATE"/>
		<field name="isWithBackorder" on="UPDATE"/>
		
		<field name="pickingOrderPrintingDetailed" on="UPDATE"/>
		<field name="isDisplaySaleValueInPrinting" on="UPDATE"/>
		<field name="isDisplayAccountingValueInPrinting" on="UPDATE"/>
		<field name="isDisplayAgPriceInPrinting" on="UPDATE"/>
		<field name="stockValuationTypeSelect" on="UPDATE"/>
		
		<field name="displayTrackNbrOnCertificateOfConformityPrinting" on="UPDATE"/>
		<field name="displayExtRefOnCertificateOfConformityPrinting" on="UPDATE"/>
	</track>
  </entity>
  
</domain-models>
