<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<object-views xmlns="http://axelor.com/xml/ns/object-views"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://axelor.com/xml/ns/object-views http://axelor.com/xml/ns/object-views/object-views_5.2.xsd">
    
    <grid name="bank-order-bank-to-bank-grid" orderBy="-bankOrderDate" title="Bank Orders" model="com.axelor.apps.bankpayment.db.BankOrder">
        <toolbar>
    		<button name="mergeBtn" title="Merge bank orders" onClick="action-bank-order-method-merge" prompt="Are you sure you want merge the selected bank orders ?"/>
    		<button name="bankOrderLinesBtn" title="See Bank Order Lines" onClick="action-bank-order-method-display-bank-order-lines-bank-to-bank" />
    	</toolbar>
		<hilite if="statusSelect &lt;= 3 &amp;&amp; $moment(bankOrderDate).diff(todayDate,'days') &lt; 2" color="danger"/>
		<hilite if="statusSelect &lt;= 3 &amp;&amp; $moment(bankOrderDate).diff(todayDate,'days') &gt;= 2" color="warning"/>
        <field name="bankOrderSeq" width="120"/>
        <field name="orderTypeSelect"/>
        <field name="bankOrderDate"/>
		<field name="confirmationDateTime"/>
        <field name="senderCompany"/>
        <field name="bankOrderTotalAmount"/>
        <field name="bankOrderCurrency"/>
        <field name="senderReference"/>
        <field name="nbOfLines"/>
        <field name="senderBankDetails.bank.bankName"/>
        <field name="signatoryEbicsUser" if-module="axelor-bank-payment" if="eval: __config__.app.getApp('bank-payment').enableEbicsModule"/>
        <field name="statusSelect"/>
    </grid>
    
    <grid name="bank-order-grid" orderBy="-bankOrderDate" title="Bank Orders" model="com.axelor.apps.bankpayment.db.BankOrder">
    	<toolbar>
    		<button name="mergeBtn" title="Merge bank orders" onClick="action-bank-order-method-merge" prompt="Are you sure you want merge the selected bank orders ?"/>
    		<button name="bankOrderLinesBtn" title="See Bank Order Lines" onClick="action-bank-order-method-display-bank-order-lines" />
    	</toolbar>
		<hilite if="statusSelect &lt;= 3 &amp;&amp; $moment(bankOrderDate).diff(todayDate,'days') &lt; 2" color="danger"/>
		<hilite if="statusSelect &lt;= 3 &amp;&amp; $moment(bankOrderDate).diff(todayDate,'days') &gt;= 2" color="warning"/>
        <field name="bankOrderSeq" width="120"/>
        <field name="partnerTypeSelect"/>
        <field name="bankOrderDate"/>
        <field name="confirmationDateTime"/>
        <field name="senderCompany" canEdit="false"/>
        <field name="bankOrderTotalAmount"/>
        <field name="bankOrderCurrency"/>
        <field name="senderReference"/>
        <field name="nbOfLines"/>
        <field name="senderBankDetails.bank.bankName"/>
        <field name="signatoryEbicsUser" if-module="axelor-bank-payment" if="eval: __config__.app.getApp('bank-payment').enableEbicsModule"/>
        <field name="statusSelect"/>
    </grid>

    <grid name="bank-order-awaiting-signature-grid" orderBy="-bankOrderDate" title="Bank Orders" model="com.axelor.apps.bankpayment.db.BankOrder" canNew="false">
    	<toolbar>
    		<button name="mergeBtn" title="Merge bank orders" onClick="action-bank-order-method-merge" prompt="Are you sure you want merge the selected bank orders ?"/>
    	</toolbar>
		<hilite if="statusSelect &lt;= 3 &amp;&amp; $moment(bankOrderDate).diff(todayDate,'days') &lt; 2" color="danger"/>
		<hilite if="statusSelect &lt;= 3 &amp;&amp; $moment(bankOrderDate).diff(todayDate,'days') &gt;= 2" color="warning"/>
        <field name="bankOrderSeq" width="120"/>
        <field name="orderTypeSelect"/>
        <field name="partnerTypeSelect"/>
        <field name="bankOrderDate"/>
        <field name="confirmationDateTime"/>
        <field name="senderCompany" canEdit="false"/>
        <field name="bankOrderTotalAmount"/>
        <field name="bankOrderCurrency"/>
        <field name="senderReference"/>
        <field name="nbOfLines"/>
        <field name="senderBankDetails.bank.bankName"/>
        <field name="signatoryEbicsUser"/>
        <field name="statusSelect"/>
    </grid>

    <grid name="bank-order-send-grid" orderBy="-bankOrderDate" title="Bank Orders" model="com.axelor.apps.bankpayment.db.BankOrder">
    	<toolbar>
    		<button name="mergeBtn" title="Merge bank orders" onClick="action-bank-order-method-merge" prompt="Are you sure you want merge the selected bank orders ?"/>
    	</toolbar>
		<hilite if="statusSelect &lt;= 3 &amp;&amp; $moment(bankOrderDate).diff(todayDate,'days') &lt; 2" color="danger"/>
		<hilite if="statusSelect &lt;= 3 &amp;&amp; $moment(bankOrderDate).diff(todayDate,'days') &gt;= 2" color="warning"/>
        <field name="bankOrderSeq" width="120"/>
        <field name="generatedMetaFile"/>
        <field name="bankOrderDate"/>
        <field name="confirmationDateTime"/>
        <field name="senderCompany" canEdit="false"/>
        <field name="bankOrderTotalAmount"/>
        <field name="bankOrderCurrency"/>
        <field name="senderReference"/>
        <field name="senderBankDetails.bank.bankName"/>
        <field name="signatoryEbicsUser" if="eval: __config__.app.getApp('bank-payment').enableEbicsModule"/>
        <field name="statusSelect"/>
    </grid>
    
	<form name="bank-order-form" title="Bank Order" model="com.axelor.apps.bankpayment.db.BankOrder"
		  onNew="action-bank-order-group-onnew"
		  onLoad="action-bank-order-group-on-load">
		<toolbar>
			<button name="printBtn" title="Print" icon="fa-print" onClick="action-bank-order-method-print"/>
		</toolbar>
		<panel title="Status" name="statusPanel" readonlyIf="technicalOriginSelect == 1">
			<field name="statusSelect" showTitle="false" widget="NavSelect" colSpan="10" selection-in="[1,3,4,5,6]" showIf="orderTypeSelect == 2 || orderTypeSelect == 4"/>
	    	<field name="statusSelect" showTitle="false" widget="NavSelect" colSpan="10" showIf="orderTypeSelect != 2 &amp;&amp; orderTypeSelect != 4"/>
			<field name="$technicalOriginTags" colSpan="2" showTitle="false" readonlyIf="true">
                  <viewer depends="technicalOriginSelect">
                    <![CDATA[
                      <h4 class="text-right">
	                      <span class="label label-info" style="margin: 5px 0 !important; display: inline-table; line-height: initial;" ng-show="record.technicalOriginSelect == 0" x-translate>Entry</span>
	                      <span class="label label-info" style="margin: 5px 0 !important; display: inline-table; line-height: initial;" ng-show="record.technicalOriginSelect == 1" x-translate>Automatic</span>
	                      <span class="label label-info" style="margin: 5px 0 !important; display: inline-table; line-height: initial;" ng-show="record.technicalOriginSelect == 2" x-translate>Import</span>
                      </h4>
                    ]]>
                  </viewer>
            </field>
		</panel>
  		<panel name="mainPanel" colSpan="12">
  			<panel name="mainPanel" colSpan="12" readonlyIf="statusSelect &gt;= 2">
	  			<field name="bankOrderSeq" css="label-bold bold" colSpan="12" readonly="true"/>
	    		<field name="bankOrderDate" css="label-bold bold" colSpan="6" hidden="true" hideIf="isMultiDate"/>
	    		<field name="orderTypeSelect" css="label-bold bold" colSpan="6" readonly="true" readonlyIf="technicalOriginSelect == 1"/>
	    		<field name="paymentMode" css="label-bold bold" colSpan="6" canView="false" domain="self.orderTypeSelect = :orderTypeSelect" onChange="action-bank-order-record-payment-mode-change,action-bank-order-attrs-bank-order-file-format-change,action-bank-order-record-update-bankorder-currency,action-bank-order-record-update-bank-order-parameter" readonlyIf="technicalOriginSelect == 1"/>
	    		<field name="bankOrderFileFormat" form-view="bank-order-file-format-form" grid-view="bank-order-file-format-grid" canView="false" domain="self.orderTypeSelect = :orderTypeSelect AND self.fileGenerationSupported = 'true'" colSpan="6" onChange="action-bank-order-attrs-bank-order-file-format-change,action-bank-order-record-update-bankorder-currency,action-bank-order-record-update-bank-order-parameter" readonlyIf="technicalOriginSelect == 1"/>
	    		<field name="partnerTypeSelect" css="label-bold bold" colSpan="6" onChange="action-bank-order-group-partner-type-select-change" hideIf="orderTypeSelect == 5 || orderTypeSelect == 6" required="true" readonlyIf="technicalOriginSelect == 1"/>
		        <field name="generatedMetaFile" widget="binary-link" showIf="statusSelect &gt;= 2" readonlyIf="technicalOriginSelect == 1"/>
	        </panel>
	        <panel name="mainPanel" colSpan="12" readonlyIf="statusSelect &gt;= 3" >  
		        <field name="signatoryUser" canNew="false" canEdit="false" canView="false" form-view="user-form" grid-view="user-grid" hidden="true"/>
		        <field name="signatoryEbicsUser" form-view="ebics-user-form" grid-view="ebics-user-grid" canView="false" onChange="action-bank-order-record-fill-signatory-user" domain=":senderBankDetails IN self.ebicsPartner.bankDetailsSet AND self.userTypeSelect = 1 AND self.statusSelect = 3" showIf="senderBankDetails" if="eval: __config__.app.getApp('bank-payment').enableEbicsModule"/>
		        <field name="signatoryEbicsUser.ebicsPartner.testMode" hidden="true"/>
		        <field name="$viewerPartnerTestMode" readonly="true" showTitle="false" hideIf="!signatoryEbicsUser.ebicsPartner.testMode || statusSelect >= 4">
		        	<viewer depends="signatoryEbicsUser.ebicsPartner.testMode">
		        	<![CDATA[
		        		<h4>
		        			<span class="label label-default" style="background-color: #FC6355; margin: 5px 0 !important; display: inline-table; line-height: initial;" ng-show="record.signatoryEbicsUser.ebicsPartner.testMode" x-translate="true">Test mode</span>
		        		</h4>
		        	]]>
		        	</viewer>
		        </field>
		        <field name="testMode" hidden="true"/>
		        <field name="$viewerTestMode" showTitle="false" showIf="testMode">
		        	<viewer depends="testMode">
		        	<![CDATA[
		        		<h4>
		        			<span class="label label-default" style="background-color: #FC6355; margin: 5px 0 !important; display: inline-table; line-height: initial;" ng-show="record.testMode" x-translate="true">Test mode</span>
		        		</h4>
		        	]]>
		        	</viewer>
		        </field>
	    		<field name="isMultiDate" hidden="true"/>
	    		<field name="isMultiCurrency" hidden="true"/>
	  		</panel>
        </panel>
	   
		<panel name="senderInfoPanel" title="Sender Info." readonlyIf="statusSelect &gt;= 2 || technicalOriginSelect == 1" showIf="paymentMode &amp;&amp; bankOrderFileFormat &amp;&amp; partnerTypeSelect" >
			<field name="senderCompany" canEdit="false" canView="false" grid-view="company-grid" form-view="company-form" required="true" onChange="action-bank-order-group-sender-company-change"/>
			<field name="senderBankDetails" canEdit="false" grid-view="bank-details-bank-order-company-grid" form-view="bank-details-form" required="true" onChange="action-bank-order-group-sender-bank-details-onchange" onSelect="action-bank-order-method-bank-details-domain"/>
			
			<panel name="bankOrderDetailPanel" hidden="true" hideIf="isMultiCurrency" >
				<field name="bankOrderTotalAmount" colSpan="6" readonly="true"/>
				<field name="bankOrderCurrency" onChange="action-bank-order-record-currency-onchange" canView="false" grid-view="currency-grid" form-view="currency-form" colSpan="6" readonlyIf="orderTypeSelect == 1 || orderTypeSelect == 2 || orderTypeSelect == 5 || bankOrderLineList.length > 0"/>
			</panel>
			<panel name="companyCurrencyPanel" readonly="true">
				<field name="companyCurrencyTotalAmount" colSpan="6"/>
				<field name="companyCurrency" canView="false" grid-view="currency-grid" form-view="currency-form" colSpan="6"/>
			</panel>
			
			<field name="senderReference"/>
			<field name="senderLabel"/>
		</panel>
		<panel name="bankOrderLinesPanel" title="Bank Order Lines" readonlyIf="statusSelect &gt;= 2 || technicalOriginSelect == 1" showIf="paymentMode &amp;&amp; bankOrderFileFormat &amp;&amp; partnerTypeSelect &amp;&amp; senderBankDetails &amp;&amp; senderCompany">
    		<field name="bankOrderLineList" showTitle="false" colSpan="12" canNew="bankOrderLineList == null || bankOrderLineList.length &lt; 10">
				<editor x-layout="table" x-show-on-new="false" x-viewer="true" onNew="action-bank-order-line-onnew">
					<field name="sequence" css="label-bold bold" readonly="true" hideIf="sequence == null" colSpan="6"/>
					<field name="bankOrderDate" hidden="true"/>
					<panel name="receiverCompanyPanel" colSpan="6" itemSpan="12">
						<field name="receiverCompany" canEdit="false" form-view="company-form" grid-view="company-grid" css="label-bold bold" onChange="action-bank-order-line-group-receiver-company-change,action-bank-order-line-record-receiver-bank-details-onchange,action-bank-order-line-method-fill-receiver-address"/>
						<field name="partner" canView="false" form-view="partner-form" grid-view="partner-grid" css="label-bold bold" onSelect="action-bank-order-line-attrs-partner-domain" onChange="action-bank-order-line-method-fill-bank-details,action-bank-order-line-record-receiver-bank-details-onchange,action-bank-order-line-method-fill-receiver-address"/>
					</panel>
                    <panel name="receiverBankDetailsPanel" colSpan="6" itemSpan="12">
                        <field name="receiverBankDetails" showIf="receiverCompany" canView="false" onSelect="action-bank-order-line-method-set-bank-details-domain" required="true" onChange="action-bank-order-line-record-receiver-bank-details-onchange" form-view="bank-details-form" grid-view="bank-details-bank-order-company-grid"/>
    					<field name="receiverBankDetails" showIf="!receiverCompany" canView="false" onSelect="action-bank-order-line-method-set-bank-details-domain" required="true" onChange="action-bank-order-line-record-receiver-bank-details-onchange" form-view="bank-details-form" grid-view="bank-details-bank-order-grid"/>
                    </panel>
					<field name="bankOrderAmount" colSpan="4" min="0.00" required="true" onChange="action-bank-order-line-method-compute-company-currency-amount"/>
					<panel name="bankOrderCurrencyPanel" stacked="true" colSpan="2" itemSpan="12">
						<field name="bankOrder.bankOrderCurrency" canView="false" hidden="true"/>
						<field name="bankOrderCurrency" canView="false" hidden="true" onChange="action-bank-order-line-method-compute-company-currency-amount"/>
					</panel>
					<panel name="companyCurrencyPanel" colSpan="6">
						<field name="companyCurrencyAmount" canView="false" colSpan="8" readonly="true"/>
						<field name="bankOrder.companyCurrency" canView="false" colSpan="4"/>
					</panel>
					<field name="receiverReference"/>
					<field name="receiverLabel"/>
					
					<panel name="additionnalInformationPanel" title="Additional information" colSpan="12" canCollapse="true" collapseIf="true" hidden="true">
						<field name="bankOrderEconomicReason" canEdit="false"/>
						<field name="receiverCountry" canView="false" colSpan="4"/>
						<field name="receiverCountry.alpha2Code" colSpan="2" showTitle="false"/>
						<field name="paymentModeSelect"/>
						<field name="feesImputationModeSelect"/>
						<field name="receiverAddressStr" colSpan="12" max="105"/>
					</panel>
					
					<panel name="furtherInformationPanel" title="Further information" colSpan="12" canCollapse="true" collapseIf="true" hidden="true">
						<panel name="paymentReasonPanel" title="Payment Reason" css="label-small" itemSpan="12">
							<field name="paymentReasonLine1" showTitle="false" requiredIf="specialInstructionsLine1 || specialInstructionsLine2 || specialInstructionsLine3"/>
							<field name="paymentReasonLine2" showTitle="false"/>
							<field name="paymentReasonLine3" showTitle="false"/>
							<field name="paymentReasonLine4" showTitle="false"/>
						</panel>
						<panel name="specialInstructionPanel" title="Special instructions" css="small" itemSpan="12">
							<field name="specialInstructionsLine1" showTitle="false"/>
							<field name="specialInstructionsLine2" showTitle="false"/>
							<field name="specialInstructionsLine3" showTitle="false"/>
						</panel>
					</panel>
					<panel name="originPanel" title="Origins" colSpan="12" canCollapse="true" collapseIf="true" showIf="bankOrderLineOriginList != null &amp;&amp; bankOrderLineOriginList.length &gt; 0">
						 <field name="bankOrderLineOriginList" showTitle="false" colSpan="12" readonly="true"/>
					</panel>
					<panel name="accountingInfoPanel" title="Accounting information" colSpan="12" hidden="true" showIf="senderMove &amp;&amp; (bankOrder.statusSelect == 3 || bankOrder.statusSelect == 4)">
						<field name="senderMove" form-view="move-form" grid-view="move-grid" />
						<field name="receiverMove" showIf="receiverMove" form-view="move-form" grid-view="move-grid" />
					</panel>
					
					<panel name="rejectInfoPanel" title="Reject information" colSpan="12" hidden="true" showIf="isRejected">
						<field name="rejectDate"/>
						<field name="rejectMove" hidden="true" showIf="isRejected == true" form-view="move-form" grid-view="move-grid"/>
						<field name="interbankCodeLine" onSelect="action-bank-order-attrs-interbank-code-line-domain" form-view="interbank-code-line-form" grid-view="interbank-code-line-grid"/>
						<field name="interbankCodeLine.description" colSpan="12"/>
						<field name="isRejected" hidden="true"/>
					</panel>
					<field name="bankOrder.isMultiDate" hidden="true"/>
					<field name="bankOrder.isMultiCurrency" hidden="true"/>
					<field name="counter" hidden="true"/>
				</editor>
			</field>
		</panel>
  		<panel name="actionPanel" title="Action" itemSpan="12" sidebar="true" hideIf="statusSelect == 4 || statusSelect == 5">
    		<button name="confirmBtn" title="Confirm" showIf="statusSelect == 1" onClick="action-bank-order-group-confirm"/>
    		<button name="signBtn" title="Sign" showIf="statusSelect == 2" onClick="save,action-bank-order-method-sign"/>
    		<button name="carryOutBtn" title="Carry out" showIf="statusSelect == 3" onClick="save,action-bank-order-method-realize,save"/>
<!-- 			<button name="reject" title="Reject" showIf="statusSelect == 3 || statusSelect == 4" onClick="save,action-bank-order-record-reject,action-method-bank-order-payment-cancel,save"/>    		 -->
    		<button name="cancelBtn" title="Cancel" showIf="statusSelect == 1 || statusSelect == 2 || statusSelect == 3" prompt="This action is irreversible, do you want to continue ?" onClick="save,action-bank-order-method-cancel,save"/>
			<button name="correctBtn" title="Correct" showIf="statusSelect == 2 || statusSelect == 3" prompt="The payment status will not update." onClick="save,action-bank-order-record-correct,save"/>
  		</panel>
  		<panel name="dateTimePanel" sidebar="true" showIf="statusSelect &gt;= 2 || technicalOriginSelect == 1" itemSpan="12" readonly="true">
  			<field name="confirmationDateTime"/>
  			<field name="fileGenerationDateTime" showIf="fileGenerationDateTime"/>
  			<field name="validationDateTime" showIf="statusSelect &gt;= 3"/>
  			<field name="sendingDateTime" showIf="statusSelect == 4"/>
  		</panel>
		<panel-mail name="mailPanel">
			<mail-messages limit="4"/>
			<mail-followers/>
		</panel-mail>
	</form>
	
	<form title="Bank Order" model="com.axelor.apps.bankpayment.db.BankOrder" name="bank-order-awaiting-signature-form" canNew="false">
		<panel-include view="bank-order-form"/>
	</form>

	<form name="bank-order-send-form" title="Send a bank order" model="com.axelor.apps.bankpayment.db.BankOrder"
	onNew="action-bank-order-group-onnew">
		<toolbar>
			<button name="printBtn" title="Print" icon="fa-print" onClick="action-bank-order-method-print"/>
		</toolbar>
		<panel name="statusPanel" title="Status" readonlyIf="technicalOriginSelect == 1">
			<field name="statusSelect" showTitle="false" widget="NavSelect" colSpan="10"/>
			<field name="$technicalOriginTags" colSpan="2" showTitle="false" readonlyIf="true">
                  <viewer depends="technicalOriginSelect">
                    <![CDATA[
                      <h4 class="text-right">
	                      <span class="label label-info" style="margin: 5px 0 !important; display: inline-table; line-height: initial;" ng-show="record.technicalOriginSelect == 0" x-translate>Entry</span>
	                      <span class="label label-info" style="margin: 5px 0 !important; display: inline-table; line-height: initial;" ng-show="record.technicalOriginSelect == 1" x-translate>Automatic</span>
	                      <span class="label label-info" style="margin: 5px 0 !important; display: inline-table; line-height: initial;" ng-show="record.technicalOriginSelect == 2" x-translate>Import</span>
                      </h4>
                    ]]>
                  </viewer>
            </field>
		</panel>
  		<panel name="mainPanel" colSpan="12">
			<panel name="detailPanel" colSpan="12" readonlyIf="statusSelect &gt;= 2 || technicalOriginSelect == 1">
				<field name="bankOrderSeq" css="label-bold bold" colSpan="6" readonly="true"/>
				<field name="generatedMetaFile" required="true" widget="binary-link" title="File to send"/>
				<field name="paymentMode" css="label-bold bold" colSpan="6" onChange="action-bank-order-record-payment-mode-change,action-bank-order-record-update-bankorder-currency"/>
		    	<field name="bankOrderFileFormat" colSpan="6" onChange="action-bank-order-record-update-bankorder-currency"/>
				<field name="bankOrderTotalAmount" colSpan="4"/>
				<field name="bankOrderCurrency" canView="false" grid-view="currency-grid" form-view="currency-form" colSpan="2"/>
				<field name="senderCompany" canEdit="false" grid-view="company-grid" form-view="company-form" colSpan="6" onChange="action-bank-order-group-sender-company-change"/>
				<field name="senderBankDetails" canView="false" grid-view="bank-details-bank-order-company-grid" form-view="bank-details-form" colSpan="6" onChange="action-bank-order-group-sender-bank-details-onchange" onSelect="action-bank-order-method-bank-details-domain"/>
				<field name="orderTypeSelect" hidden="true"/>
			</panel>
	        <panel name="signatoryPanel" colSpan="12" readonlyIf="statusSelect &gt;= 3">  	
				<field name="signatoryEbicsUser" form-view="ebics-user-form" grid-view="ebics-user-grid" requiredIf="statusSelect == 2" onChange="action-bank-order-record-fill-signatory-user" colSpan="6" domain=":senderBankDetails IN self.ebicsPartner.bankDetailsSet AND self.statusSelect = 3" showIf="senderBankDetails" if="eval: __config__.app.getApp('bank-payment').enableEbicsModule"/>
				<field name="signatoryUser" canNew="false" canEdit="false" canView="false" form-view="user-form" grid-view="user-grid" hidden="true"/>
				<field name="signatoryEbicsUser.ebicsPartner.testMode" hidden="true"/>
				<field name="$viewerPartnerTestMode" readonly="true" showTitle="false" hideIf="!signatoryEbicsUser.ebicsPartner.testMode || statusSelect >= 4">
					<viewer depends="signatoryEbicsUser.ebicsPartner.testMode">
					<![CDATA[
					<h4>
						<span class="label label-default" style="background-color: #FC6355; margin: 5px 0 !important; display: inline-table; line-height: initial;" ng-show="record.signatoryEbicsUser.ebicsPartner.testMode" x-translate="true">Test mode</span>
					</h4>
					]]>
					</viewer>
				</field>
				<field name="testMode" hidden="true"/>
				<field name="$viewerTestMode" showTitle="false" showIf="testMode">
					<viewer depends="testMode">
					<![CDATA[
					<h4>
						<span class="label label-default" style="background-color: #FC6355; margin: 5px 0 !important; display: inline-table; line-height: initial;" ng-show="record.testMode" x-translate="true">Test mode</span>
					</h4>
					]]>
					</viewer>
				</field>
			</panel>
		</panel>
		<panel name="actionPanel" title="Action" itemSpan="12" sidebar="true" hideIf="statusSelect == 4 || statusSelect == 5">
    		<button name="confirmBtn" title="Confirm" showIf="statusSelect == 1" onClick="action-bank-order-group-confirm"/>
    		<button name="signBtn" title="Sign" showIf="statusSelect == 2" onClick="save,action-bank-order-method-sign"/>
    		<button name="carryOutBtn" title="Carry out" showIf="statusSelect == 3" onClick="save,action-bank-order-method-realize,save"/>
    		<button name="cancelBtn" title="Cancel" showIf="statusSelect == 1 || statusSelect == 2 || statusSelect == 3" prompt="This action is irreversible, do you want to continue ?" onClick="save,action-bank-order-method-cancel"/>
			<button name="correctBtn" title="Correct" showIf="statusSelect == 2 || statusSelect == 3" prompt="The payment status will not update." onClick="save,action-bank-order-record-correct,save"/>
  		</panel>
  		<panel name="dateTimePanel" sidebar="true" showIf="statusSelect &gt;= 2 || technicalOriginSelect == 1" itemSpan="12" readonly="true">
  			<field name="confirmationDateTime"/>
  			<field name="validationDateTime" showIf="statusSelect &gt;= 3"/>
  			<field name="sendingDateTime" showIf="statusSelect == 4"/>
  		</panel>
    </form>
	
	<form name="bank-order-sign-wizard-form" title="Sign bank order" model="com.axelor.apps.bankpayment.db.BankOrder">
  		<panel name="detailPanel" colSpan="6">
    		<panel name="bankOrderDetailPanel" hidden="true" hideIf="isMultiCurrency" readonly="true">
				<field name="bankOrderTotalAmount" colSpan="8"/>
				<field name="bankOrderCurrency" canView="false" grid-view="currency-grid" form-view="currency-form" colSpan="4"/>
			</panel>
			<panel name="companyCurrencyPanel" readonly="true">
				<field name="companyCurrencyTotalAmount" colSpan="8"/>
				<field name="companyCurrency" canView="false" grid-view="currency-grid" form-view="currency-form" colSpan="4"/>
			</panel>
    		<field name="signatoryEbicsUser" title="Ebics User" widget="SuggestBox" colOffset="1" canEdit="false" colSpan="6" required="true" grid-view="ebics-user-grid" form-view="ebics-user-form" domain=":senderBankDetails IN self.ebicsPartner.bankDetailsSet AND self.statusSelect = 3"/>
    		<field name="$password" title="Password" widget="password" colOffset="1"  colSpan="6" required="true"/>
    		<button name="validateBtn" title="Validate" colOffset="1"  colSpan="6" onClick="save,action-bank-order-method-validate,close"/>
    		<field name="isMultiCurrency" hidden="true"/>
  		</panel>
	</form>
	
	<!-- BANK ORDER ACTIONS -->
		<!-- Actions Groups-->
		
	<action-group name="action-bank-order-group-onnew">
		<action name="action-bank-order-record-default"/>
		<action name="action-bank-order-record-partner-type-select-default"/>
		<action name="action-bank-order-group-sender-company-change"/>
		<action name="action-bank-order-group-sender-bank-details-onchange"/>
        <action name="action-bank-order-method-fill-bankdetails"/>
		<action name="action-bank-order-record-fill-signatory-user"/>
	</action-group>

    <action-group name="action-bank-order-group-sender-bank-details-onchange">
		<action name="action-bank-order-method-fill-signatory-ebics-user"/>
        <action name="action-bank-order-record-update-bankorder-currency"/>
	</action-group>
	
	<action-group name="action-bank-order-group-confirm">
		<action name="save"/>
  		<action name="action-bank-order-method-confirm"/>
	</action-group>

	<action-group name="action-bank-order-group-on-load">
        <action name="action-bank-order-attrs-show-partner-or-receiver-company"/>
        <action name="action-bank-order-attrs-on-load"/>
	</action-group>

	<action-group name="action-bank-order-group-sender-company-change">
		<action name="action-bank-order-record-update-company-currency"/>
		<action name="action-bank-order-record-update-bankorder-currency"/>
		<action name="action-bank-order-method-fill-bankdetails"/>
	</action-group>

    <action-group name="action-bank-order-group-partner-type-select-change">
        <action name="action-bank-order-attrs-show-partner-or-receiver-company"/>
        <action name="action-bank-order-method-reset-receivers"/>
    </action-group>

		<!-- Actions Attributes -->

	<action-attrs name="action-bank-order-attrs-on-load">
		<attribute name="hidden" for="bankOrderLineList.additionnalInformationPanel" expr="eval: !bankOrderFileFormat?.displayAdditionnalInformations"/>
		<attribute name="hidden" for="bankOrderLineList.bankOrderEconomicReason" expr="eval: !bankOrderFileFormat?.displayBankOrderEconomicReason"/>
		<attribute name="hidden" for="bankOrderLineList.receiverCountry" expr="eval: !bankOrderFileFormat?.displayReceiverCountry"/>
		<attribute name="hidden" for="bankOrderLineList.receiverCountry.alpha2Code" expr="eval: !bankOrderFileFormat?.displayReceiverCountry"/>
		<attribute name="hidden" for="bankOrderLineList.paymentModeSelect" expr="eval: !bankOrderFileFormat?.displayPaymentModeSelect"/>
		<attribute name="hidden" for="bankOrderLineList.feesImputationModeSelect" expr="eval: !bankOrderFileFormat?.displayFeesImputationModeSelect"/>
		<attribute name="hidden" for="bankOrderLineList.furtherInformationPanel" expr="eval: !bankOrderFileFormat?.displayFurtherInformations"/>
		<attribute name="hidden" for="bankOrderLineList.bankOrderDate" expr="eval: !bankOrderFileFormat?.isMultiDate"/>
		<attribute name="hidden" for="bankOrderLineList.bankOrderCurrency" expr="eval: !bankOrderFileFormat?.isMultiCurrency"/>
		<attribute name="hidden" for="bankOrderLineList.bankOrder.bankOrderCurrency" expr="eval: bankOrderFileFormat?.isMultiCurrency"/>
		<attribute name="hidden" for="bankOrderLineList.receiverAddressStr" expr="eval: !bankOrderFileFormat?.displayReceiverAddress"/>
	</action-attrs>
	
	<action-attrs name="action-bank-order-attrs-bank-order-file-format-change">
		<attribute name="value" for="bankOrderLineList.bankOrderEconomicReason" expr="eval: bankOrderFileFormat?.bankOrderEconomicReason"/>
		<attribute name="value" for="bankOrderLineList.receiverCountry" expr="eval: bankOrderFileFormat?.receiverCountry"/>
		<attribute name="value" for="bankOrderLineList.paymentModeSelect" expr="eval: bankOrderFileFormat?.paymentModeSelect"/>
		<attribute name="value" for="bankOrderLineList.feesImputationModeSelect" expr="eval: bankOrderFileFormat?.feesImputationModeSelect"/>
		<attribute name="value" for="bankOrderLineList.bankOrder.companyCurrency" expr="companyCurrency" if="eval: !bankOrderFileFormat?.isMultiCurrency"/>
		
		<attribute name="hidden" for="bankOrderLineList.additionnalInformationPanel" expr="eval: !bankOrderFileFormat?.displayAdditionnalInformations"/>
		<attribute name="hidden" for="bankOrderLineList.bankOrderEconomicReason" expr="eval: !bankOrderFileFormat?.displayBankOrderEconomicReason"/>
		<attribute name="hidden" for="bankOrderLineList.receiverCountry" expr="eval: !bankOrderFileFormat?.displayReceiverCountry"/>
		<attribute name="hidden" for="bankOrderLineList.receiverCountry.alpha2Code" expr="eval: !bankOrderFileFormat?.displayReceiverCountry"/>
		<attribute name="hidden" for="bankOrderLineList.paymentModeSelect" expr="eval: !bankOrderFileFormat?.displayPaymentModeSelect"/>
		<attribute name="hidden" for="bankOrderLineList.feesImputationModeSelect" expr="eval: !bankOrderFileFormat?.displayFeesImputationModeSelect"/>
		<attribute name="hidden" for="bankOrderLineList.furtherInformationPanel" expr="eval: !bankOrderFileFormat?.displayFurtherInformations"/>
		<attribute name="hidden" for="bankOrderLineList.bankOrderDate" expr="eval: !bankOrderFileFormat?.isMultiDate"/>
		<attribute name="hidden" for="bankOrderLineList.bankOrderCurrency" expr="eval: !bankOrderFileFormat?.isMultiCurrency"/>
		<attribute name="hidden" for="bankOrderLineList.bankOrder.bankOrderCurrency" expr="eval: bankOrderFileFormat?.isMultiCurrency"/>
		<attribute name="hidden" for="bankOrderLineList.receiverAddressStr" expr="eval: !bankOrderFileFormat?.displayReceiverAddress"/>
	</action-attrs>
	
	<action-attrs name="action-bank-order-line-attrs-on-new-from-bank-order-file-format">
		<attribute name="value" for="bankOrderEconomicReason" expr="eval: __parent__.bankOrderFileFormat?.bankOrderEconomicReason"/>
		<attribute name="value" for="receiverCountry" expr="eval: __parent__.bankOrderFileFormat?.receiverCountry"/>
		<attribute name="value" for="paymentModeSelect" expr="eval: __parent__.bankOrderFileFormat?.paymentModeSelect"/>
		<attribute name="value" for="feesImputationModeSelect" expr="eval: __parent__.bankOrderFileFormat?.feesImputationModeSelect"/>
		<attribute name="value" for="bankOrder.companyCurrency" expr="__parent__.companyCurrency"/>
	
		<attribute name="hidden" for="additionnalInformationPanel" expr="eval: !__parent__.bankOrderFileFormat?.displayAdditionnalInformations"/>
		<attribute name="hidden" for="bankOrderEconomicReason" expr="eval: !__parent__.bankOrderFileFormat?.displayBankOrderEconomicReason"/>
		<attribute name="hidden" for="receiverCountry" expr="eval: !__parent__.bankOrderFileFormat?.displayReceiverCountry"/>
		<attribute name="hidden" for="receiverCountry.alpha2Code" expr="eval: !__parent__.bankOrderFileFormat?.displayReceiverCountry"/>
		<attribute name="hidden" for="paymentModeSelect" expr="eval: !__parent__.bankOrderFileFormat?.displayPaymentModeSelect"/>
		<attribute name="hidden" for="feesImputationModeSelect" expr="eval: !__parent__.bankOrderFileFormat?.displayFeesImputationModeSelect"/>
		<attribute name="hidden" for="furtherInformationPanel" expr="eval: !__parent__.bankOrderFileFormat?.displayFurtherInformations"/>
		<attribute name="hidden" for="bankOrderDate" expr="eval: !__parent__.bankOrderFileFormat?.isMultiDate"/>
		<attribute name="hidden" for="bankOrderCurrency" expr="eval: !__parent__.bankOrderFileFormat?.isMultiCurrency"/>
		<attribute name="hidden" for="bankOrder.bankOrderCurrency" expr="eval: __parent__.bankOrderFileFormat?.isMultiCurrency"/>
		<attribute name="hidden" for="receiverAddressStr" expr="eval: !__parent__.bankOrderFileFormat?.displayReceiverAddress"/>
	</action-attrs>

	<action-attrs name="action-bank-order-attrs-show-partner-or-receiver-company">
		<attribute for="bankOrderLineList.receiverCompany" name="hidden" expr="eval: partnerTypeSelect != 4"/>
		<attribute for="bankOrderLineList.partner" name="hidden" expr="eval: partnerTypeSelect == 4"/>
	</action-attrs>

    	<!-- Actions Records -->
    	
    <action-record name="action-bank-order-record-default" model="com.axelor.apps.bankpayment.db.BankOrder">
		<field name="orderTypeSelect" expr="eval: _orderTypeSelect" if="_orderTypeSelect != null"/>
		<field name="partnerTypeSelect" expr="eval: _partnerTypeSelect" if="_partnerTypeSelect != null"/>
		<field name="bankOrderDate" expr="eval:__config__.app.getTodayDate()"/>
		<field name="senderCompany" expr="eval:__user__.activeCompany"/>
	</action-record>
	
	<action-record name="action-bank-order-record-update-bankorder-currency" model="com.axelor.apps.bankpayment.db.BankOrder">
        <field name="bankOrderCurrency" expr="eval: bankOrderFileFormat?.currency"/>
		<field name="bankOrderCurrency" if="bankOrderFileFormat?.currency == null"
			   expr="eval: senderBankDetails?.currency"/>
		<field name="bankOrderCurrency" if="bankOrderFileFormat?.currency == null &amp;&amp; senderBankDetails?.currency == null"
			   expr="eval: senderCompany?.currency"/>
	</action-record>
	
	<action-record name="action-bank-order-record-update-bank-order-parameter" model="com.axelor.apps.bankpayment.db.BankOrder">
        <field name="isMultiDate" expr="eval: bankOrderFileFormat?.isMultiDate"/>
		<field name="isMultiCurrency" expr="eval: bankOrderFileFormat?.isMultiCurrency"/>
	</action-record>
	
	<action-record name="action-bank-order-record-update-company-currency" model="com.axelor.apps.bankpayment.db.BankOrder">
		<field name="companyCurrency" expr="eval: senderCompany?.currency"/>
	</action-record>
	
	<action-record name="action-bank-order-record-payment-mode-change" model="com.axelor.apps.bankpayment.db.BankOrder">
		<field name="bankOrderFileFormat" expr="eval: paymentMode?.bankOrderFileFormat"/>
	</action-record>
	
	<action-record name="action-bank-order-record-reject" model="com.axelor.apps.bankpayment.db.BankOrder">
		<field name="statusSelect" expr="5"/>
		<field name="rejectStatusSelect" expr="2"/>
	</action-record>

	<action-record name="action-bank-order-record-correct" model="com.axelor.apps.bankpayment.db.BankOrder">
		<field name="statusSelect" expr="1"/>
	</action-record>
	
	<action-record name="action-bank-order-record-partner-type-select-default" model="com.axelor.apps.bankpayment.db.BankOrder">
		<field name="partnerTypeSelect" expr="3" if="orderTypeSelect == 2 || orderTypeSelect == 4"/>
	</action-record>

	<action-record name="action-bank-order-record-fill-signatory-user" model="com.axelor.apps.bankpayment.db.BankOrder">
		<field name="signatoryUser" expr="eval: signatoryEbicsUser?.associatedUser"/>
	</action-record>

	<action-record name="action-bank-order-record-currency-onchange" model="com.axelor.apps.bankpayment.db.BankOrder">
		<field name="senderBankDetails" if="!bankOrderFileFormat?.allowOrderCurrDiffFromBankDetails" expr="eval: null"/>
	</action-record>

		<!-- Actions Methods -->
	
	<action-method name="action-bank-order-method-confirm">
		<call class="com.axelor.apps.bankpayment.web.BankOrderController" method="confirm"/>
	</action-method>

	<action-method name="action-bank-order-method-sign">
		<call class="com.axelor.apps.bankpayment.web.BankOrderController" method="sign"/>
	</action-method>
	
  	<action-method name="action-bank-order-method-validate">
		<call class="com.axelor.apps.bankpayment.web.BankOrderController" method="validate"/>
	</action-method>
	
  	<action-method name="action-bank-order-method-realize">
		<call class="com.axelor.apps.bankpayment.web.BankOrderController" method="realize"/>
	</action-method>
	
	<action-method name="action-bank-order-method-merge">
		<call class="com.axelor.apps.bankpayment.web.BankOrderController" method="merge"/>
	</action-method>
	
	<action-method name="action-bank-order-method-print">
    	<call class="com.axelor.apps.bankpayment.web.BankOrderController" method="print"/>
    </action-method>

	<action-method name="action-bank-order-method-fill-signatory-ebics-user" model="com.axelor.apps.bankpayment.db.BankOrder">
		<call class="com.axelor.apps.bankpayment.web.BankOrderController" method="fillSignatoryEbicsUser"/>
	</action-method>

	<action-method name="action-bank-order-method-bank-details-domain">
		<call class="com.axelor.apps.bankpayment.web.BankOrderController" method="setBankDetailDomain"/>
    </action-method>

	<action-method name="action-bank-order-method-fill-bankdetails">
		<call class="com.axelor.apps.bankpayment.web.BankOrderController" method="fillBankDetails"/>
	</action-method>

    <action-method name="action-bank-order-method-reset-receivers">
        <call class="com.axelor.apps.bankpayment.web.BankOrderController" method="resetReceivers"/>
    </action-method>
	
	<action-method name="action-bank-order-method-cancel" model="com.axelor.apps.bankpayment.db.BankOrder">
		<call class="com.axelor.apps.bankpayment.web.BankOrderController" method="cancel"/>
	</action-method>

	<!-- BANK ORDER LINES ACTIONS -->

        <!-- Actions Groups -->

	<action-group name="action-bank-order-line-group-receiver-company-change">
		<action name="action-bank-order-line-record-receiver-company-change"/>
		<action name="action-bank-order-line-method-fill-bank-details"/>
	</action-group>

	<action-group name="action-bank-order-line-onnew">
		<action name="action-bank-order-line-record-compute-counter"/>
        <action name="action-bank-order-line-attrs-show-partner-or-receiver-company"/>
        <action name="action-bank-order-line-attrs-on-new-from-bank-order-file-format"/>
	</action-group>

		<!-- Actions Attributes -->
		
    <action-attrs name="action-bank-order-line-attrs-partner-domain">
		<attribute name="domain" for="partner" expr="self.isCustomer = true" if="_parent.partnerTypeSelect == 3"/>    
		<attribute name="domain" for="partner" expr="self.isEmployee = true" if="_parent.partnerTypeSelect == 2"/>
		<attribute name="domain" for="partner" expr="self.isSupplier = true" if="_parent.partnerTypeSelect == 1"/>
		<attribute name="domain" for="partner" expr="self.isSupplier = false AND self.isEmployee = false AND self.isCustomer = false AND self.isContact = false" if="__parent__.partnerTypeSelect == 5"/>
    </action-attrs>
    
     <action-attrs name="action-bank-order-attrs-interbank-code-line-domain">
		<attribute name="domain" for="interbankCodeLine" expr="self.transferCfonbOk = true" if="_parent.orderTypeSelect in (3,5,6)"/>
		<attribute name="domain" for="interbankCodeLine" expr="self.directDebitSepaOk = true" if="_parent.orderTypeSelect == 2"/>
		<attribute name="domain" for="interbankCodeLine" expr="self.directDebitAndTipCfonbOk = true" if="_parent.orderTypeSelect == 4"/>      
    </action-attrs>

	<action-attrs name="action-bank-order-line-attrs-show-partner-or-receiver-company">
		<attribute for="receiverCompany" name="hidden" expr="eval: __parent__.partnerTypeSelect != 4"/>
		<attribute for="receiverCompany" name="required" expr="eval: __parent__.partnerTypeSelect == 4"/>
		<attribute for="partner" name="hidden" expr="eval: __parent__.partnerTypeSelect == 4"/>
		<attribute for="partner" name="required" expr="eval: __parent__.partnerTypeSelect != 4"/>
	</action-attrs>

	<!-- Actions Records -->

    <action-record name="action-bank-order-line-record-compute-counter" model="com.axelor.apps.bankpayment.db.BankOrderLine">
  		<field name="counter" expr="eval: __parent__?.bankOrderLineList?.max { it.counter }?.counter + 1" if="__parent__?.bankOrderLineList?.max { it.counter }?.counter"/>
	</action-record>

	<action-record name="action-bank-order-line-record-receiver-company-change" model="com.axelor.apps.bankpayment.db.BankOrderLine">
		<field name="partner" expr="eval: receiverCompany?.partner"/>
	</action-record>

	<action-record name="action-bank-order-line-record-receiver-bank-details-onchange" model="com.axelor.apps.bankpayment.db.BankOrderLine">
		<field name="bankOrderCurrency" expr="eval: receiverBankDetails?.currency" if="__parent__?.isMultiCurrency"/>
		<field name="receiverCountry" expr="eval: receiverBankDetails?.bank?.country" if="__parent__?.bankOrderFileFormat?.orderFileFormatSelect?.equals('pain.xxx.cfonb320.xct')"/>
	</action-record>
	
 	<action-record name="action-bank-order-line-method-fill-receiver-address" model="com.axelor.apps.bankpayment.db.BankOrderLine">
		<field name="receiverAddressStr" expr="call:com.axelor.apps.bankpayment.service.bankorder.BankOrderLineService:getReceiverAddress(partner)"  if="__parent__?.bankOrderFileFormat?.orderFileFormatSelect?.equals('pain.xxx.cfonb320.xct')"/>	
	</action-record>

	<!-- Actions Methods -->

    <action-method name="action-bank-order-line-method-fill-bank-details">
        <call class="com.axelor.apps.bankpayment.web.BankOrderLineController" method="fillBankDetail"/>
    </action-method>

	<action-method name="action-bank-order-line-method-set-bank-details-domain">
		<call class="com.axelor.apps.bankpayment.web.BankOrderLineController" method="setBankDetailsDomain"/>
	</action-method>
	
    <action-method name="action-bank-order-line-method-compute-company-currency-amount">
        <call class="com.axelor.apps.bankpayment.web.BankOrderLineController" method="computeCompanyCurrencyAmount"/>
    </action-method>
    
	<action-method name="action-bank-order-method-display-bank-order-lines">
		<call class="com.axelor.apps.bankpayment.web.BankOrderController" method="displayBankOrderLines"/>
	</action-method>

	<action-method name="action-bank-order-method-display-bank-order-lines-bank-to-bank">
		<call class="com.axelor.apps.bankpayment.web.BankOrderController" method="displayBankOrderLinesBankToBank"/>
	</action-method>

</object-views>
