<?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="PaymentScheduleLine" lang="java">
  
  	<many-to-one name="paymentSchedule" ref="com.axelor.apps.account.db.PaymentSchedule" title="Payment Schedule"/>
    <integer name="scheduleLineSeq" title="Schedule line N°" required="true"/>
    <decimal name="inTaxAmount" title="Amount A.T.I."/>
    <decimal name="inTaxAmountPaid" title="Amount paid A.T.I."/>
    <date name="scheduleDate" title="Schedule Date" required="true"/>
    <boolean name="rejectedOk" title="Rejected" default="false"/>
    <boolean name="debitBlockingOk" title="Debit blocking" default="false"/>
    <integer name="statusSelect" title="Status" readonly="true" selection="iaccount.payment.schedule.line.status.select" default="1"/>
    <date name="rejectDate" title="Rejection date"/>
    <many-to-one name="interbankCodeLine" ref="com.axelor.apps.account.db.InterbankCodeLine" title="Rejection reason"/>
    <many-to-one name="advanceMoveLine" ref="com.axelor.apps.account.db.MoveLine" title="Advance move line"/>
    <string name="debitNumber" title="Direct debit Nbr"/>
    <many-to-one name="directDebitManagement" ref="com.axelor.apps.account.db.DirectDebitManagement" title="Direct debit management"/>
    <many-to-one name="rejectMoveLine" ref="com.axelor.apps.account.db.MoveLine" title="Rejection move line"/>
    <many-to-one name="advanceOrPaymentMove" ref="com.axelor.apps.account.db.Move" title="Advance/Payment move"/>
    <boolean name="fromReject" title="From rejection" default="false"/>
    <decimal name="amountRejected" title="Amount rejected"/> 
   	<many-to-many name="batchSet" ref="com.axelor.apps.base.db.Batch" title="Batches"/>
    
    <decimal name="directDebitAmount" title="Debited amount" readonly="true"/> 
    
    <string name="name" namecolumn="true" search="paymentSchedule,scheduleLineSeq">
	    <![CDATA[
	    	if (paymentSchedule != null && paymentSchedule.getPaymentScheduleSeq() != null) return paymentSchedule.getPaymentScheduleSeq() + " - " + scheduleLineSeq;
	    	else if(scheduleLineSeq != null)  return scheduleLineSeq.toString();
	    	else return " - ";
	    ]]>
    </string>

    <finder-method name="findByIdList" using="java.util.List&lt;Long&gt;:idList" filter="self.id IN (:idList)" all="true"/>

   	<extra-code><![CDATA[
	
	   	// STATUS SELECT
		public static final int STATUS_DRAFT = 1;
		public static final int STATUS_IN_PROGRESS = 2;
		public static final int STATUS_VALIDATED = 3;
		public static final int STATUS_CLOSED = 4;
	
	]]></extra-code>   

  </entity>
  
</domain-models>