<?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="batch-grid" title="Batches" model="com.axelor.apps.base.db.Batch" orderBy="-id"
    canEdit="false" canDelete="false" canNew="false" canSave="false">
    	<field name="id" />
		<field name="createdBy" form-view="user-form" grid-view="user-grid"/>
		<field name="duration" widget="duration" x-big="true"/>
		<field name="startDate" />
		<field name="endDate" />
		<field name="done" />
		<field name="anomaly" />
    </grid>
    
    <form name="batch-form" title="Batch" model="com.axelor.apps.base.db.Batch" onNew="action-batch-attrs" onLoad="action-batch-attrs" 
    canEdit="false" canDelete="false" canNew="false" canCopy="false" canSave="false" width="large">
		<panel name="mainPanel">
		    <field name="createdBy" form-view="user-form" grid-view="user-grid"/>
		    <field name="duration" widget="duration" x-big="true"/>
		    <field name="startDate" required="true"/>
		    <field name="endDate"/>
		    <field name="done"/>
		    <field name="anomaly"/>
		    <field name="metaFile" hidden="true" showIf="metaFile != null" widget="binary-link"  />
		    <field name="comments" showTitle="false" colSpan="12"/>
		    <button name="showTraceBackBtn" title="Anomalies" colSpan="4" onClick="action-batch-show-trace-back,close"/>
		    <button name="showInvoiceBtn" title="Invoices" hidden="true" colSpan="4" onClick="action-batch-show-invoice" if-module="axelor-account,close"/>
		    <button name="showReimbursementBtn" title="Reimbursements" hidden="true" colSpan="4" onClick="action-batch-show-reimbursement,close" if-module="axelor-account"/>
		    <button name="showPaymentScheduleLineBtn" title="Schedule lines" hidden="true" colSpan="4" onClick="action-batch-show-payment-schedule-line,close" if-module="axelor-account"/>
		    <button name="showPartnerBtn" title="Partners" hidden="true" colSpan="4" onClick="action-batch-show-partner,close"/>
		    <button name="showAccountingSituationBtn" title="Accounting situations" hidden="true" colSpan="4" onClick="action-batch-show-accounting-situation,close" if-module="axelor-account"/>
		    <button name="showPaymentVoucherBtn" title="Payment vouchers" hidden="true" colSpan="4" onClick="action-batch-show-payment-voucher,close" if-module="axelor-account"/>
        	<button name="showAccountingReportBtn" title="Accounting Exports" hidden="true" colSpan="4" onClick="action-batch-show-accounting-report,close" if-module="axelor-account"/>
        	<button name="showStockMoveBtn" title="Stock moves" hidden="true" colSpan="4" onClick="action-batch-show-stock-move,close" if-module="axelor-supplychain"/>
        	<button name="showStockMoveLinesBtn" title="Stock move lines" hidden="true" colSpan="4" onClick="action-batch-show-stock-move-lines,close" if-module="axelor-supplychain"/>
        	<button name="showAccountMoveBtn" title="Account moves" hidden="true" colSpan="4" onClick="action-batch-show-move,close" if-module="axelor-supplychain"/>
            <button name="showBankOrderBtn" title="Show bank order" hidden="true" colSpan="4" onClick="action-batch-show-bank-order,close" if-module="axelor-bank-payment"/>
  		    <button name="showEbicsCertificatesBtn" title="Ebics certificates" hidden="true" colSpan="4" onClick="action-batch-show-ebics-certificates,close" if-module="axelor-bank-payment"/>
            <button name="createBankOrderBtn" title="Create bank order" hidden="true" colSpan="4" onClick="action-batch-create-bank-order,action-batch-show-bank-order,close" if-module="axelor-bank-payment" />
            <field name="bankOrder" hidden="true" if-module="axelor-bank-payment" />
		</panel>
    </form>
    
     <action-attrs name="action-batch-attrs">
        <attribute name="hidden" for="showInvoiceBtn" expr="eval: _parent?.invoiceTypeSelect != 1" if="_parent?._model == 'com.axelor.apps.invoice.db.InvoiceBatch'"/>

    	<attribute name="hidden" for="showInvoiceBtn" expr="eval: !(_parent?.actionSelect in [12,15,16])" if="_parent?._model == 'com.axelor.apps.account.db.AccountingBatch'" />
    	<attribute name="hidden" for="showReimbursementBtn" expr="eval: !(_parent?.actionSelect in [11])" if="_parent?._model == 'com.axelor.apps.account.db.AccountingBatch'" />
    	<attribute name="hidden" for="showPaymentScheduleLineBtn" expr="eval: !(_parent?.actionSelect in [12])" if="_parent?._model == 'com.axelor.apps.account.db.AccountingBatch'" />
    	<attribute name="hidden" for="showPaymentVoucherBtn" expr="eval: !(_parent?.actionSelect in [13,15])" if="_parent?._model == 'com.axelor.apps.account.db.AccountingBatch'" />
    	
    	<attribute name="hidden" for="showPartnerBtn" expr="eval: !(_parent?.actionSelect in [14])" if="_parent?._model == 'com.axelor.apps.account.db.AccountingBatch'" />
    	<attribute name="hidden" for="showAccountingSituationBtn" expr="eval: !(_parent?.actionSelect in [17])" if="_parent?._model == 'com.axelor.apps.account.db.AccountingBatch'" />
    	
    	<attribute name="hidden" for="showAccountingReportBtn" expr="eval: !(_parent?.actionSelect == 18)" if="_parent?._model == 'com.axelor.apps.account.db.AccountingBatch'" />

        <attribute name="hidden" for="showBankOrderBtn" expr="eval: !bankOrder" if="__parent__?._model == 'com.axelor.apps.account.db.AccountingBatch'" />
        <attribute name="hidden" for="createBankOrderBtn" expr="eval: !(__parent__?.actionSelect == 12 &amp;&amp; !bankOrder &amp;&amp; done)" if="__parent__?._model == 'com.axelor.apps.account.db.AccountingBatch'" />
    	<attribute name="hidden" for="showEbicsCertificatesBtn" expr="eval: false" if="_parent?._model == 'com.axelor.apps.bankpayment.db.BankPaymentBatch'"/>

    	<attribute name="hidden" for="showStockMoveBtn" expr="eval: false" if="_parent?._model == 'com.axelor.apps.supplychain.db.SupplychainBatch'"/>
    	<attribute name="hidden" for="showStockMoveLinesBtn" expr="eval: false" if="_parent?._model == 'com.axelor.apps.supplychain.db.SupplychainBatch'"/>
    	<attribute name="hidden" for="showAccountMoveBtn" expr="eval: false" if="_parent?._model == 'com.axelor.apps.supplychain.db.SupplychainBatch' || _parent?._model == 'com.axelor.apps.account.db.AccountingBatch'"/>
    	<attribute name="hidden" for="showAccountMoveBtn" expr="eval: false" if="_parent?._model == 'com.axelor.apps.supplychain.db.SupplychainBatch'"/>

    </action-attrs>

	<action-view name="action-batch-show-trace-back" title="Anomalies"
		model="com.axelor.exception.db.TraceBack">
		<view type="grid" name="trace-back-grid"/>
		<view type="form" name="trace-back-form"/>
		<domain>self.batchId = :id</domain>
		<context name="id" expr="eval: id"/>
	</action-view>

	<action-view name="action-batch-show-batch" model="com.axelor.apps.base.db.Batch"
		title="Batch">
		<view name="batch-form" type="form" />
		<context name="_showRecord" expr="eval: batchId" />
	</action-view>

	<action-view name="action-batch-show-invoice" title="Invoices"
		model="com.axelor.apps.account.db.Invoice">
		<view type="grid" name="invoice-grid"/>
		<view type="form" name="invoice-form"/>
		<domain>:batch MEMBER OF self.batchSet</domain>
		<context name="batch" expr="eval: __self__"/>
	</action-view>
	
	<action-view name="action-batch-show-move" title="Moves"
		model="com.axelor.apps.account.db.Move">
		<view type="grid" name="move-grid"/>
		<view type="form" name="move-form"/>
		<domain>:batch MEMBER OF self.batchSet</domain>
		<context name="batch" expr="eval: __self__"/>
	</action-view>
	
	<action-view name="action-batch-show-reimbursement" title="Reimbursements"
		model="com.axelor.apps.account.db.Reimbursement">
		<view type="grid" name="reimbursement-grid"/>
		<view type="form" name="reimbursement-form"/>
		<domain>:batch MEMBER OF self.batchSet</domain>
		<context name="batch" expr="eval: __self__"/>
	</action-view>
	
	<action-view name="action-batch-show-payment-schedule-line" title="Schedule lines"
		model="com.axelor.apps.account.db.PaymentScheduleLine">
		<view type="grid" name="payment-schedule-line-grid"/>
		<view type="form" name="payment-schedule-line-form"/>
		<domain>:batch MEMBER OF self.batchSet</domain>
		<context name="batch" expr="eval: __self__"/>
	</action-view>


	<action-view name="action-batch-show-payment-voucher" title="Payment vouchers"
		model="com.axelor.apps.account.db.PaymentVoucher">
		<view type="grid" name="payment-voucher-grid"/>
		<view type="form" name="payment-voucher-form"/>
		<domain>:batch MEMBER OF self.batchSet</domain>
		<context name="batch" expr="eval: __self__"/>
	</action-view>
	
	<action-view name="action-batch-show-partner" title="Partners"
		model="com.axelor.apps.base.db.Partner">
		<view type="grid" name="partner-grid"/>
		<view type="form" name="partner-form"/>
		<domain>:batch MEMBER OF self.batchSet</domain>
		<context name="batch" expr="eval: __self__"/>
	</action-view>
	
	<action-view name="action-batch-show-accounting-situation" title="Accounting situations"
		model="com.axelor.apps.account.db.AccountingSituation">
		<view type="grid" name="accounting-situation-grid"/>
		<view type="form" name="accounting-situation-form"/>
		<domain>:batch MEMBER OF self.batchSet</domain>
		<context name="batch" expr="eval: __self__"/>
	</action-view>
	
	<action-view name="action-batch-show-accounting-report" title="Move exports"
		model="com.axelor.apps.account.db.AccountingReport">
		<view type="grid" name="accounting-report-export-grid"/>
		<view type="form" name="accounting-report-export-form"/>
		<domain>:batch MEMBER OF self.batchSet</domain>
		<context name="batch" expr="eval: __self__"/>
	</action-view>

	<action-view name="action-batch-show-ebics-certificates" title="Ebics certificate"
		model="com.axelor.apps.bankpayment.db.EbicsCertificate">
		<view type="grid" name="ebics-certificate-grid"/>
		<view type="form" name="ebics-certificate-form"/>
		<view-param name="show-toolbar" value="false"/>
		<domain>:batch MEMBER OF self.batchSet</domain>
		<context name="batch" expr="eval: __self__"/>
	</action-view>

</object-views>