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

  <entity name="InvoicePayment" lang="java">
  
 	<decimal name="amount" title="Amount" required="true" default="0" min="0" initParam="true"/>
 	
 	<date name="paymentDate" title="Date" required="true" initParam="true"/>
 	<string name="delayReason" title="Delay reason"/>
 	
 	<many-to-one name="currency" ref="com.axelor.apps.base.db.Currency" title="Currency" required="true" initParam="true"/>
  	<many-to-one name="paymentMode" ref="com.axelor.apps.account.db.PaymentMode" title="Payment mode" initParam="true"/>
  	<date name="bankDepositDate" title="Date of bank deposit"/>	
  	<string name="chequeNumber" title="Cheque number"/>
  	<many-to-one name="move" ref="com.axelor.apps.account.db.Move" title="Move" readonly="true" index="idx_account_inv_payment_move"/>
  	<many-to-one name="reconcile" ref="com.axelor.apps.account.db.Reconcile" readonly="true" title="Reconcile"/>
 	
 	<many-to-one name="invoice" ref="com.axelor.apps.account.db.Invoice" initParam="true"/>
	<many-to-one name="companyBankDetails" ref="com.axelor.apps.base.db.BankDetails"/>

    <many-to-one name="imputedBy" ref="com.axelor.apps.account.db.InvoicePayment"/>

 	<integer name="typeSelect" title="Type" selection="invoice.payment.type.select" initParam="true"/>
 	 	 	
 	<integer name="statusSelect" title="Status" readonly="true" selection="invoice.payment.status.select" initParam="true"/>
  	
  	<string name="invoicePaymentRef" title="Reference"/>

	<string name="description" title="Description"/>
	
	<string name="chequeModelBank" title="Model"  selection="account.invoice.payment.bank.select"/>
	<string name="wilaya" title="Wilaya"/>
	
	<finder-method name="findByReconcile" using="reconcile" all="true"/>

  	<extra-code>
   		<![CDATA[
   		
   		// STATUS SELECT
		public static final int STATUS_DRAFT = 0;
		public static final int STATUS_VALIDATED = 1;
		public static final int STATUS_CANCELED = 2;
		public static final int STATUS_PENDING = 3;
	
	   	// TYPE SELECT
		public static final int TYPE_ADVANCEPAYMENT = 1;
		public static final int TYPE_PAYMENT = 2;
		public static final int TYPE_REFUND_INVOICE = 3;
		public static final int TYPE_INVOICE = 4;
		public static final int TYPE_OTHER = 5;
		public static final int TYPE_ADV_PAYMENT_IMPUTATION = 6;

	]]></extra-code>
  	
  </entity>

</domain-models>
