<?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">

    <!-- VUE GENERALE -->

  <grid name="invoice-grid" title="Invoices" model="com.axelor.apps.account.db.Invoice" orderBy="-invoiceDate">
   	<menubar>
	    <menu name="invoiceReportsMenu" title="Reports" icon="fa-files-o" showTitle="true">
	      <item name="printInvoicesItem" title="Print invoices" action="action-invoice-method-show-invoice"/>
	  	</menu>
     	<menu name="invoiceToolsMenu" title="Tools" icon="fa-wrench" showTitle="true">
	      <item name="validateSelectedInvoicesItem" title="Validate selected invoices" action="action-invoice-method-mass-validation" prompt="Are you sure you want to validate all selected invoices ?" />
	      <item name="ventilateSelectedInvoicesItem" title="Ventilate selected invoices" action="action-invoice-method-mass-ventilation" prompt="Are you sure you want to ventilate all selected invoices ?" if="!__config__.app.getApp('invoice').isVentilationSkipped"/>
	      <item name="mergeCustInvoicesItem" title="Merge Cust. Invoices" action="action-invoice-mergecustinvoices" />
	      <item name="seeCustInvoicesLinesItem" title="See cust. invoices lines" action="action-customer-invoice-line-menu" />
	    </menu>
	</menubar>
   	<hilite color="primary" if="statusSelect == 1"/>
    <hilite color="danger" if="statusSelect == 3 &amp;&amp; amountRemaining &gt; 0 &amp;&amp; $moment(dueDate).diff(todayDate,'days') &lt; 0"/>
    <hilite color="warning" if="statusSelect == 3 &amp;&amp; amountRemaining &gt; 0 &amp;&amp; $moment(dueDate).diff(todayDate,'days') &gt;= 0 &amp;&amp; $moment(dueDate).diff(todayDate,'days') &lt;= 5"/>
    <hilite color="success" if="statusSelect == 3 &amp;&amp; amountRemaining == 0"/>
    <field name="invoiceId" width="120"/>
		<field name="company" form-view="company-form" grid-view="company-grid" widget="200" if="__config__.app.getApp('base').getEnableMultiCompany()"/>
		<field name="tradingName" form-view="trading-name-form" grid-view="trading-name-grid" if="__config__.app.getApp('base').enableTradingNamesManagement" widget="200"/>
    <field name="partner" form-view="partner-form" grid-view="partner-grid" width="200"/>
		<field name="operationSubTypeSelect" widget="160"/>
    <field name="invoiceDate" width="120"/>
    <field name="dueDate" width="120"/>
    <field name="exTaxTotal" aggregate="sum" width="120"/>
    <field name="inTaxTotal" aggregate="sum" width="120"/>
    <field name="amountRemaining" aggregate="sum" width="120"/>
    <field name="currency" width="60"/>
    <field name="statusSelect" width="100"/>
    <button name="showInvoiceBtn" title="Print" icon="fa-print" onClick="action-invoice-method-show-invoice"/>
    <button name="sendByEmailBtn" title="Send email" icon="fa-envelope" onClick="action-validate-send-email-remove-access-for-client,action-send-by-email-with-template"/>
  </grid>

  <grid name="invoice-refund-grid" title="Invoices" model="com.axelor.apps.account.db.Invoice" orderBy="-invoiceDate">
	<menubar>
      <menu name="invoiceReportsMenu" title="Reports" icon="fa-files-o" showTitle="true">
        <item name="printInvoicesItem" title="Print invoices" action="action-invoice-method-show-invoice"/>
	  </menu>
	  <menu name="invoiceToolsMenu" title="Tools" icon="fa-wrench" showTitle="true">
	      <item name="validateSelectedInvoicesItem" title="Validate selected invoices" action="action-invoice-method-mass-validation" prompt="Are you sure you want to validate all selected invoices ?" />
	      <item name="ventilateSelectedInvoicesItem" title="Ventilate selected invoices" action="action-invoice-method-mass-ventilation" prompt="Are you sure you want to ventilate all selected invoices ?" if="!__config__.app.getApp('invoice').isVentilationSkipped"/>
	      <item name="mergeCustInvoicesItem" title="Merge Cust. Invoices" action="action-invoice-mergecustinvoices" />
	      <item name="seeCustInvoicesLinesItem" title="See cust. invoices lines" action="action-customer-invoice-line-menu" />
	      <item name="paySelectedInvoicesItem" title="Pay selected invoices" action="action-invoice-method-register-mass-payment-on-supplier-invoices"/>
		</menu>
		</menubar>
		<hilite color="primary" if="statusSelect == 1"/>
		<hilite color="danger" if="statusSelect == 3 &amp;&amp; amountRemaining &gt; 0 &amp;&amp; $moment(dueDate).diff(todayDate,'days') &lt; 0"/>
		<hilite color="warning" if="statusSelect == 3 &amp;&amp; amountRemaining &gt; 0 &amp;&amp; $moment(dueDate).diff(todayDate,'days') &gt;= 0 &amp;&amp; $moment(dueDate).diff(todayDate,'days') &lt;= 5"/>
		<hilite color="success" if="statusSelect == 3 &amp;&amp; amountRemaining == 0"/>
    <field name="invoiceId" width="120"/>
		<field name="company" form-view="company-form" grid-view="company-grid" widget="200" if="__config__.app.getApp('base').getEnableMultiCompany()"/>
		<field name="tradingName" form-view="trading-name-form" grid-view="trading-name-grid" if="__config__.app.getApp('base').enableTradingNamesManagement" widget="200"/>
    <field name="partner" form-view="partner-form" grid-view="partner-grid" width="200"/>
		<field name="operationSubTypeSelect" widget="160"/>
		<field name="paymentMode" grid-view="payment-mode-grid" form-view="payment-mode-form" width="160"/>
    <field name="invoiceDate" width="120"/>
    <field name="dueDate" width="120"/>
    <field name="exTaxTotal" aggregate="sum" width="120"/>
    <field name="inTaxTotal" aggregate="sum" width="120"/>
    <field name="amountRemaining" aggregate="sum" width="120"/>
    <field name="currency" width="60"/>
    <field name="statusSelect" width="100"/>
    <button name="showInvoiceBtn" title="Print" icon="fa-print" onClick="action-invoice-method-show-invoice"/>
    <button name="sendByEmailBtn" title="Send email" icon="fa-envelope" onClick="action-validate-send-email-remove-access-for-client,action-send-by-email-with-template"/>
  </grid>

  <grid name="invoice-supplier-grid" title="Invoices" model="com.axelor.apps.account.db.Invoice" orderBy="-invoiceDate">
    <menubar>
      <menu name="invoiceReportsMenu" title="Reports" icon="fa-files-o" showTitle="true">
        <item name="printInvoicesItem" title="Print invoices" action="action-invoice-method-show-invoice"/>
			</menu>
			<menu name="invoiceToolsMenu" title="Tools" icon="fa-wrench" showTitle="true">
				<item name="validateSelectedInvoicesItem" title="Validate selected invoices" action="action-invoice-method-mass-validation" prompt="Are you sure you want to validate all selected invoices ?" />
				<item name="ventilateSelectedInvoicesItem" title="Ventilate selected invoices" action="action-invoice-method-mass-ventilation" prompt="Are you sure you want to ventilate all selected invoices ?" if="!__config__.app.getApp('invoice').isVentilationSkipped"/>
				<item name="paySelectedInvoicesItem" title="Pay selected invoices" action="action-invoice-method-register-mass-payment-on-supplier-invoices"/>
				<item name="seeSupplInvoicesLinesItem" title="See suppl. invoices lines" action="action-supplier-invoice-line-menu" />
				<item title="See budget distribution lines" action="action-invoice-see-budget-distribution-lines"/>
			</menu>
		</menubar>
		<hilite color="primary" if="statusSelect == 1"/>
		<hilite color="danger" if="statusSelect == 3 &amp;&amp; amountRemaining &gt; 0 &amp;&amp; $moment(dueDate).diff(todayDate,'days') &lt; 0"/>
		<hilite color="warning" if="statusSelect == 3 &amp;&amp; amountRemaining &gt; 0 &amp;&amp; $moment(dueDate).diff(todayDate,'days') &gt;= 0 &amp;&amp; $moment(dueDate).diff(todayDate,'days') &lt;= 5"/>
    <hilite color="success" if="statusSelect == 3 &amp;&amp; amountRemaining == 0"/>
    <field name="invoiceId" width="120"/>
		<field name="company" form-view="company-form" grid-view="company-grid" widget="200" if="__config__.app.getApp('base').getEnableMultiCompany()"/>
    <field name="supplierInvoiceNb"/>
    <field name="partner" form-view="partner-form" grid-view="partner-grid"/>
    <field name="paymentMode" grid-view="payment-mode-grid" form-view="payment-mode-form"/>
    <field name="originDate"/>
    <field name="invoiceDate"/>
    <field name="dueDate"/>
    <field name="exTaxTotal" aggregate="sum"/>
    <field name="inTaxTotal" aggregate="sum"/>
    <field name="amountRemaining" aggregate="sum"/>
    <field name="currency" />
    <field name="statusSelect"/>
    <field name="pfpValidateStatusSelect" title="PFP" if="__config__.app.getApp('account').getActivatePassedForPayment()"/>
        <field name="pfpValidatorUser" title="PFP val." if="__config__.app.getApp('account').getActivatePassedForPayment()"/>
		<field name="company.accountConfig" hidden="true" if="__config__.app.getApp('account').getActivatePassedForPayment()"/>
		<field name="company.accountConfig.isManagePassedForPayment" hidden="true" if="__config__.app.getApp('account').getActivatePassedForPayment()"/>
        <button name="showInvoiceBtn" title="Print" icon="fa-print" onClick="action-invoice-method-show-invoice"/>
    <button name="sendByEmailBtn" title="Send email" icon="fa-envelope" onClick="action-send-by-email-with-template"/>
  </grid>

  <grid name="invoice-supplier-refund-grid" title="Invoices" model="com.axelor.apps.account.db.Invoice" orderBy="-invoiceDate">
    <menubar>
      <menu name="invoiceReportsMenu" title="Reports" icon="fa-files-o" showTitle="true">
        <item name="printInvoicesItem" title="Print invoices" action="action-invoice-method-show-invoice"/>
      </menu>
			<menu name="invoiceToolsMenu" title="Tools" icon="fa-wrench" showTitle="true">
	      <item name="validateSelectedInvoicesItem" title="Validate selected invoices" action="action-invoice-method-mass-validation" prompt="Are you sure you want to validate all selected invoices ?" />
	      <item name="ventilateSelectedInvoicesItem" title="Ventilate selected invoices" action="action-invoice-method-mass-ventilation" prompt="Are you sure you want to ventilate all selected invoices ?" if="!__config__.app.getApp('invoice').isVentilationSkipped"/>
	      <item name="paySelectedInvoicesItem" title="Pay selected invoices" action="action-invoice-method-register-mass-payment-on-supplier-invoices"/>
          <item name="seeSupplInvoicesLinesItem" title="See suppl. invoices lines" action="action-supplier-invoice-line-menu" />
          <item title="See budget distribution lines" action="action-invoice-see-budget-overview-lines"/>
      </menu>
		</menubar>
	 	<hilite color="primary" if="statusSelect == 1"/>
	  <hilite color="danger" if="statusSelect == 3 &amp;&amp; amountRemaining &gt; 0 &amp;&amp; $moment(dueDate).diff(todayDate,'days') &lt; 0"/>
	  <hilite color="warning" if="statusSelect == 3 &amp;&amp; amountRemaining &gt; 0 &amp;&amp; $moment(dueDate).diff(todayDate,'days') &gt;= 0 &amp;&amp; $moment(dueDate).diff(todayDate,'days') &lt;= 5"/>
	  <hilite color="success" if="statusSelect == 3 &amp;&amp; amountRemaining == 0"/>
		<field name="invoiceId" width="120"/>
		<field name="company" form-view="company-form" grid-view="company-grid" widget="200" if="__config__.app.getApp('base').getEnableMultiCompany()"/>
		<field name="supplierInvoiceNb"/>
		<field name="operationTypeSelect"/>
		<field name="operationSubTypeSelect"/>
		<field name="partner" form-view="partner-form" grid-view="partner-grid"/>
		<field name="originDate"/>
		<field name="invoiceDate"/>
		<field name="dueDate"/>
		<field name="exTaxTotal" aggregate="sum"/>
		<field name="inTaxTotal" aggregate="sum"/>
		<field name="amountRemaining" aggregate="sum"/>
		<field name="currency" />
		<field name="statusSelect"/>
		<button name="showInvoiceBtn" title="Print" icon="fa-print" onClick="action-invoice-method-show-invoice"/>
		<button name="sendByEmailBtn" title="Send email" icon="fa-envelope" onClick="action-send-by-email-with-template"/>
  </grid>

    <grid name="invoice-light-grid" title="Invoices" model="com.axelor.apps.account.db.Invoice" orderBy="-invoiceDate">
    	<menubar>
            <menu name="invoiceReportsMenu" title="Reports" icon="fa-files-o" showTitle="true">
	            <item name="printInvoicesItem" title="Print invoices" action="action-invoice-method-show-invoice"/>
	     	</menu>
			<menu title="Tools" icon="fa-wrench" showTitle="true">
	            <item name="validateSelectedInvoicesItem" title="Validate selected invoices" action="action-invoice-method-mass-validation" prompt="Are you sure you want to validate all selected invoices ?" />
	            <item name="ventilateSelectedInvoicesItem" title="Ventilate selected invoices" action="action-invoice-method-mass-ventilation" prompt="Are you sure you want to ventilate all selected invoices ?" if="!__config__.app.getApp('invoice').isVentilationSkipped"/>
	            <item name="seeSupplInvoicesLinesItem" title="See suppl. invoices lines" action="action-supplier-invoice-line-menu" />
	            <item name="generateSubscriptionsInvoicesItem" title="Generate subscriptions invoices" action="action-supplychain-method-generate-subscription-invoice" if="__config__.app.isApp('supplychain')"/>
	     	</menu>
		</menubar>
    	<hilite color="primary" if="statusSelect == 1"/>
	    <hilite color="danger" if="statusSelect == 3 &amp;&amp; amountRemaining &gt; 0 &amp;&amp; $moment(dueDate).diff(todayDate,'days') &lt; 0"/>
	    <hilite color="warning" if="statusSelect == 3 &amp;&amp; amountRemaining &gt; 0 &amp;&amp; $moment(dueDate).diff(todayDate,'days') &gt;= 0 &amp;&amp; $moment(dueDate).diff(todayDate,'days') &lt;= 5"/>
	    <hilite color="success" if="statusSelect == 3 &amp;&amp; amountRemaining == 0"/>
        <field name="invoiceId" width="120"/>
        <field name="invoiceDate"/>
		<field name="operationTypeSelect" />
		<field name="operationSubTypeSelect"/>
		<field name="exTaxTotal" aggregate="sum"/>
        <field name="amountRemaining" aggregate="sum"/>
        <field name="currency"/>
        <field name="statusSelect"/>
        <button name="showInvoiceBtn" title="Print" icon="fa-print" onClick="action-invoice-method-show-invoice"/>
        <button name="sendByEmailBtn" title="Send email" icon="fa-envelope" onClick="action-validate-send-email-remove-access-for-client,action-send-by-email-with-template"/>
    </grid>

    <grid name="invoice-refund-invoice-grid" title="Invoices" model="com.axelor.apps.account.db.Invoice" orderBy="-invoiceDate">
    	<hilite color="primary" if="statusSelect == 1"/>
	    <hilite color="danger" if="statusSelect == 3 &amp;&amp; amountRemaining &gt; 0 &amp;&amp; $moment(dueDate).diff(todayDate,'days') &lt; 0"/>
	    <hilite color="warning" if="statusSelect == 3 &amp;&amp; amountRemaining &gt; 0 &amp;&amp; $moment(dueDate).diff(todayDate,'days') &gt;= 0 &amp;&amp; $moment(dueDate).diff(todayDate,'days') &lt;= 5"/>
	    <hilite color="success" if="statusSelect == 3 &amp;&amp; amountRemaining == 0"/>
        <field name="invoiceId" width="120"/>
        <field name="invoiceDate"/>
		<field name="operationTypeSelect" />
		<field name="exTaxTotal" aggregate="sum"/>
        <field name="amountRemaining" aggregate="sum"/>
        <field name="statusSelect"/>
        <button name="showInvoiceBtn" title="Print" icon="fa-print" onClick="action-invoice-method-show-invoice"/>
    </grid>

    <form name="invoice-form" title="Invoice" model="com.axelor.apps.account.db.Invoice"
          onNew="action-account-invoice-onnew-group"
          onLoad="action-account-invoice-onload-group" >

		<toolbar>
			<button name="reportsBtn" title="Reports" icon="fa-print" showIf="statusSelect != 4" readonlyIf="!id" onClick="save,action-invoice-view-reports-wizard"/>
		</toolbar>

        <menubar>
            <menu name="invoiceToolsMenu" title="Tools" icon="fa-wrench" showTitle="true">
                <item name="sendEmailItem" title="Send email" action="save,action-send-by-email-with-template" readonlyIf="partner == null"/>
            </menu>
        </menubar>

		<panel name="mainPanel">
			<field name="printedPDF" hidden="true"/><!-- Needed to be able to use it in menu -->
            <panel name="statusSelectPanel" colSpan="7" stacked="true">
                <field name="statusSelect" widget="NavSelect" showIf="operationSubTypeSelect != 2" showTitle="false"/>
                <field name="statusSelect" widget="NavSelect" showIf="operationSubTypeSelect == 2" showTitle="false" selection-in="[1,2,4]"/>
            </panel>
            <panel name="viewerTagsPanel" colSpan="5">
	            <field name="$viewerTags" showTitle="false" readonly="true" showIf="$readonly()" colSpan="9" depends="partner.factorizedCustomer">
	                <viewer>
	                    <![CDATA[
	                        <h4 class="text-right">
	                            <span class="label label-default" style="background-color: #B6473F; margin: 5px 0 !important; display: inline-table; line-height: initial;" ng-show="record.operationTypeSelect == 1" x-translate>Supplier purchase</span>
	                            <span class="label label-default" style="background-color: #B6473F; margin: 5px 0 !important; display: inline-table; line-height: initial;" ng-show="record.operationTypeSelect == 2" x-translate>Supplier refund</span>
	                            <span class="label label-default" style="background-color: #E0A83C; margin: 5px 0 !important; display: inline-table; line-height: initial;" ng-show="record.operationTypeSelect == 3" x-translate>Customer sale</span>
	                            <span class="label label-default" style="background-color: #E0A83C; margin: 5px 0 !important; display: inline-table; line-height: initial;" ng-show="record.operationTypeSelect == 4" x-translate>Customer refund</span>

	                            <span class="label label-info" style="margin: 5px 0 !important; display: inline-table; line-height: initial;" x-translate ng-show="record.operationSubTypeSelect == 1 && (record.operationTypeSelect == 1 || record.operationTypeSelect == 3)">Standard invoice</span>
	                            <span class="label label-info" style="margin: 5px 0 !important; display: inline-table; line-height: initial;" x-translate ng-show="record.operationSubTypeSelect == 2 && (record.operationTypeSelect == 1 || record.operationTypeSelect == 3)">Advance payment invoice</span>
	                            <span class="label label-info" style="margin: 5px 0 !important; display: inline-table; line-height: initial;" x-translate ng-show="record.operationSubTypeSelect == 3 && (record.operationTypeSelect == 1 || record.operationTypeSelect == 3)">Balance invoice</span>
	                            <span class="label label-info" style="margin: 5px 0 !important; display: inline-table; line-height: initial;" x-translate ng-show="record.operationSubTypeSelect == 4 && (record.operationTypeSelect == 1 || record.operationTypeSelect == 3)">Contract invoice</span>
	                            <span class="label label-info" style="margin: 5px 0 !important; display: inline-table; line-height: initial;" x-translate ng-show="record.operationSubTypeSelect == 5 && (record.operationTypeSelect == 1 || record.operationTypeSelect == 3)">Contract closing invoice</span>
	                            <span class="label label-info" style="margin: 5px 0 !important; display: inline-table; line-height: initial;" x-translate ng-show="record.operationSubTypeSelect == 6 && (record.operationTypeSelect == 1 || record.operationTypeSelect == 3)">Subscription</span>

	                            <span class="label label-info" style="margin: 5px 0 !important; display: inline-table; line-height: initial;" x-translate ng-show="(record.operationTypeSelect == 3 || record.operationTypeSelect == 4) && record.partner.factorizedCustomer">Factorized customer</span>

	                        </h4>
	                    ]]>
	                </viewer>
	            </field>
	            <field name="$pfpViewerTags" showTitle="false" readonly="true" showIf="$readonly()" colSpan="3" if="__config__.app.getApp('account').getActivatePassedForPayment()">
	                <viewer>
	                    <![CDATA[
	                        <h4 class="text-right">
                                    <span class="label label-warning" style="margin: 5px 0 !important; display: inline-table; line-height: initial;" x-translate ng-show="record.company.accountConfig.isManagePassedForPayment && (record.operationTypeSelect == 1 || (record.company.accountConfig.isManagePFPInRefund && record.operationTypeSelect == 2 ))  && ( record.statusSelect == 2 || record.statusSelect == 3 ) && record.pfpValidateStatusSelect == 1">Awaiting PFP</span>
                                    <span class="label label-success" style="margin: 5px 0 !important; display: inline-table; line-height: initial;" x-translate ng-show="record.company.accountConfig.isManagePassedForPayment && (record.operationTypeSelect == 1 || (record.company.accountConfig.isManagePFPInRefund && record.operationTypeSelect == 2 )) && ( record.statusSelect == 2 || record.statusSelect == 3 )  && record.pfpValidateStatusSelect == 2">PFP validated</span>
                                    <span class="label label-important" style="margin: 5px 0 !important; display: inline-table; line-height: initial;" x-translate ng-show="record.company.accountConfig.isManagePassedForPayment && (record.operationTypeSelect == 1 || (record.company.accountConfig.isManagePFPInRefund && record.operationTypeSelect == 2 ))  && ( record.statusSelect == 2 || record.statusSelect == 3 ) && record.pfpValidateStatusSelect == 3">Litigation</span>
	                        </h4>
	                    ]]>
	                </viewer>
	            </field>
            </panel>
            <field name="invoiceId" colSpan="12" css="label-bold bold large" showTitle="false" showIf="id">
                <viewer>
                    <![CDATA[
						<span ng-show="(record.operationSubTypeSelect != 2 && record.statusSelect &lt; 3) || (record.operationSubTypeSelect == 2 && record.statusSelect == 1)" x-translate>Proforma </span>
                        <span ng-show="record.statusSelect == 4" x-translate>Cancel invoice n°</span>
                        <span>{{record.invoiceId}}</span>
                        ]]>
                </viewer>
            </field>

            <panel name="operationTypePanel" colSpan="6" itemSpan="12">
                <field name="operationTypeSelect" hideIf="statusSelect &gt; 1 || partner != null || $readonly() || _operationTypeSelect != 1"
                    onChange="action-group-account-invoice-operationtype-onchange" selection-in="[1,2]"/>
                <field name="operationTypeSelect" hideIf="statusSelect &gt; 1 || partner != null || $readonly() || _operationTypeSelect != 3"
                    onChange="action-group-account-invoice-operationtype-onchange" selection-in="[3,4]"/>
            </panel>
            <field name="operationSubTypeSelect" hideIf="statusSelect &gt; 1 || operationTypeSelect != 3 || $readonly()" showTitle="true"/>
            <field name="company" canEdit="false" readonlyIf="statusSelect != 1 || partner != null" onChange="action-group-account-invoice-company-onchange" form-view="company-form" grid-view="company-grid"/>
            <field name="currency" colSpan="3" canEdit="false" onChange="action-invoice-group-currency-onchange" readonlyIf="statusSelect != 1 || (invoiceLineList &amp;&amp; invoiceLineList.length != 0)" form-view="currency-form" grid-view="currency-grid"/>
            <field name="priceList" colSpan="3" canEdit="false" onChange="action-invoice-record-hide-discount" readonlyIf="statusSelect != 1" onSelect="action-invoice-method-domain-priceList" form-view="price-list-form" grid-view="price-list-grid"/>
            <field name="tradingName" canEdit="false" grid-view="trading-name-grid" form-view="trading-name-form" if="__config__.app.getApp('base').enableTradingNamesManagement" readonlyIf="statusSelect != 1" domain=":company MEMBER OF self.companySet" onChange="action-invoice-method-printing-settings-default-values"/>
            <field name="companyBankDetails" canEdit="false" onSelect="com.axelor.apps.base.web.CompanyBankDetailsController:fillCompanyBankDetailsDomain" form-view="bank-details-form" grid-view="bank-details-grid" onChange="action-invoice-record-specific-note-on-invoice"/>
            <field name="interco" hidden="true" if-module="axelor-supplychain" if="__config__.app.isApp('supplychain')"/>
            <field name="createdByInterco" showIf="createdByInterco" readonly="true" if-module="axelor-supplychain" if="__config__.app.isApp('supplychain')"/>
            <field name="inAti" onChange="action-invoice-attrs-in-ati" readonlyIf="statusSelect != 1 || invoiceLineList.length > 0"/>
        </panel>

        <panel name="invoicingInfoPanel" title="Invoicing informations" hideIf="company == null">
            <field name="partner" colSpan="3" canEdit="false" readonlyIf="((operationTypeSelect == 3 || operationTypeSelect == 4) &amp;&amp; statusSelect != 1) || ((operationTypeSelect == 1 || operationTypeSelect == 2) &amp;&amp; (statusSelect != 1 || invoiceLineList.length > 0))"  onChange="action-group-account-invoice-partner-onchange,action-method-invoice-address-str" onSelect="action-invoice-method-set-partner-domain" form-view="partner-form" grid-view="partner-grid"/>
            <field name="contactPartner" colSpan="3" canEdit="false" onSelect="action-set-partner-domain" domain="self.isContact = true AND :company member of self.companySet" readonlyIf="partner != null &amp;&amp; partner.partnerTypeSelect == 2" form-view="partner-contact-form" grid-view="partner-contact-grid"/>
            <field name="paymentMode" colSpan="3" canEdit="false" widget="SuggestBox" onSelect="action-set-payment-mode-domain" onChange="action-invoice-method-fill-company-bank-details,action-invoice-method-check-partner-bank-details-list" form-view="payment-mode-form" grid-view="payment-mode-grid"/>
            <field name="paymentCondition" colSpan="3" canEdit="false" readonlyIf="statusSelect == 3" widget="SuggestBox" onChange="action-invoice-record-due-date" form-view="payment-condition-form" grid-view="payment-condition-grid"/>
    		<field name="$partnerBankDetailsListWarning" showTitle="false" hidden="true" readonly="true" colSpan="12">
      			<viewer><![CDATA[
               		<span x-translate style="color:red">Watch out, this partner has no active bank details</span>
           		]]></viewer>
    		</field>
    		<field name="bankDetails" canEdit="false" widget="SuggestBox" onSelect="action-invoice-attrs-bank-details-from-partner-domain" form-view="bank-details-form" grid-view="bank-details-grid"/>
           	<field name="partnerTaxNbr" readonlyIf="statusSelect != 1" hideIf="operationTypeSelect != 3 &amp;&amp; operationTypeSelect != 4" if-module="axelor-supplychain" if="__config__.app.isApp('supplychain')"/>
            <panel name="addressPanel" stacked="true">
                <field name="address" hideIf="$readonly() || statusSelect &gt; 1" onSelect="action-invoice-attrs-domain-address" onChange="action-method-invoice-address-str" canEdit="false" canNew="true" form-view="address-partner-address-form" grid-view="address-grid"/>
                <field name="addressStr" readonlyIf="statusSelect &gt; 1" height="5">
                    <viewer>{{record.addressStr}}</viewer>

              	</field>
            </panel>

            <field name="supplierInvoiceNb" showIf="operationTypeSelect == 1 || operationTypeSelect == 2" requiredIf="(operationTypeSelect == 1 || operationTypeSelect == 2) &amp;&amp; statusSelect == 2" onChange="action-account-invoice-atts-suppier-invoice-nbr"/>
		    <field name="$duplicateInvoiceNbr" hidden="true" colSpan="12" showTitle="false" readonly="true">
              <viewer>
                <![CDATA[
               	  <h4>
               	    <span class="label label-warning" style="color: #FFFFFF;" x-translate>Watch out, an invoice was already created for this supplier invoice number.</span>
                  </h4>
              	]]>
              </viewer>    
            </field>
            <field name="originDate" showIf="operationTypeSelect == 1 || operationTypeSelect == 2" requiredIf="(operationTypeSelect == 1 || operationTypeSelect == 2) &amp;&amp; statusSelect == 2" onChange="action-invoice-record-due-date,action-invoice-record-estimated-payment-date"/>
        </panel>

		<panel name="subscriptionPanel" title="Subscription period"
			   showIf="$contains([6, 7],operationSubTypeSelect)">
			<field name="subscriptionFromDate" />
			<field name="subscriptionToDate" />
		</panel>

		<panel-tabs name="mainPanelTab" hideIf="partner == null">
			<panel name="invoiceContentPanel" title="Content" showTitle="false">
				<panel-related name="invoiceLineListPanel" field="invoiceLineList" canNew="statusSelect == 1" canRemove="statusSelect == 1" readonlyIf="statusSelect == 3 || partner == null" colSpan="12" form-view="invoice-line-form" grid-view="invoice-line-grid" onChange="action-invoice-group-invoice-line-onchange" canMove="true" orderBy="sequence" height="30"/>
			</panel>
			<panel name="invoiceTaxPanel" title="Tax" showTitle="false">
				<panel-related name="invoiceLineTaxListPanel" field="invoiceLineTaxList" colSpan="12" form-view="invoice-line-tax-form" grid-view="invoice-line-tax-grid"/>
			</panel>
			<panel name="deliveryPanel" title="Delivery" hideIf="operationSubTypeSelect == 2 " if="__config__.app.isApp('supplychain') &amp;&amp; __config__.app.getApp('supplychain').getGenerateInvoiceFromStockMove()">
				<panel-related field="stockMoveSet" readonlyIf="statusSelect == 2 || statusSelect == 3" colSpan="12" grid-view="stock-move-grid" form-view="stock-move-form" onNew="action-group-stock-stockmove-onnew" onSelect="action-invoice-attrs-domain-stock-move" domain="self.partner = :partner AND self.company = :company AND self.statusSelect = 3 AND self.typeSelect &gt; 1" canNew="false" canSelect="false"/>
			</panel>
			<panel name="projectPanel" if="__config__.app.isApp('business-project') &amp;&amp; __config__.app.getApp('business-project').getGenerateProjectOrder()" title="Business project" colSpan="12" if-module="axelor-business-project">
				<field name="project" onSelect="action-invoice-attrs-domain-project" form-view="project-form" grid-view="project-grid" colSpan="6"/>
				<button name="updateLinesBtn" title="Update lines with selected project" onClick="save,action-invoice-business-project-method-update-lines,save" colSpan="6" readonlyIf="!project"/>
			</panel>
			<panel name="accountingPanel" title="Accounting" showTitle="false">
				<panel name="accountingDetailsPanel" title="Accounting details"  colSpan="12">
					<field name="journal" canEdit="false" readonlyIf="statusSelect == 3" domain="self.statusSelect = 1 AND self.company = :company" form-view="journal-form" grid-view="journal-grid"/>
					<field name="partnerAccount" canEdit="false" readonlyIf="statusSelect == 3" onSelect="action-invoice-partner-account-domain" domain="self.company = :company" form-view="account-form" grid-view="account-grid"/>
					<panel name="movePanel" showIf="move != null">
						<field name="move" readonly="true" form-view="move-form" grid-view="move-grid"/>
						<field name="move.accountingOk" readonly="true"/>
					</panel>
					<field name="doubtfulCustomerOk" readonly="true" showIf="doubtfulCustomerOk &amp;&amp; statusSelect == 3 &amp;&amp; (operationTypeSelect == 1 || operationTypeSelect == 3)"/>
					<field name="usherPassageOk" showIf="statusSelect == 3 &amp;&amp; (operationTypeSelect == 1 || operationTypeSelect == 3)" onChange="save,com.axelor.apps.account.web.InvoiceController:usherProcess"/>
					<field name="oldMove" readonly="true" showIf="oldMove" form-view="move-form" grid-view="move-grid"/>
					<field name="subrogationRelease" readonly="true" showIf="subrogationRelease"/>
					<field name="subrogationReleaseMove" readonly="true" showIf="subrogationReleaseMove"/>
				</panel>
				<panel name="refundPanel" title="Refund" showIf="statusSelect != 1 || originalInvoice"  colSpan="12" showTitle="false">
					<button name="createRefundBtn" title="Generate refund" colSpan="3" showIf="statusSelect != 1" onClick="save,action-invoice-method-create-refund,save" />
					<field name="originalInvoice" readonly="true" showIf="originalInvoice" form-view="invoice-form" grid-view="invoice-grid"/>
					<panel-related name="refundInvoiceListPanel" field="refundInvoiceList" readonly="true" showIf="refundInvoiceList != null &amp;&amp; !refundInvoiceList.isEmpty()" colSpan="12" form-view="invoice-form" grid-view="invoice-refund-invoice-grid"/>
				</panel>
				<panel colSpan="12"  name="irrecoverablePanel" title="Irrecoverable" showIf="statusSelect == 3 &amp;&amp; (operationTypeSelect == 1 || operationTypeSelect == 3)"  showTitle="false">
					<field name="irrecoverableStatusSelect"/>
					<field name="managementObject" form-view="management-object-form" grid-view="management-object-grid"/>
					<panel name="irrecoverableDetailsPanel" colSpan="6" stacked="true">
					<button name="passInIrrecoverableBtn" title="Shift to irrecoverable"   onClick="com.axelor.apps.account.web.InvoiceController:passInIrrecoverable" showIf="irrecoverableStatusSelect == 0"/>
					<button name="notPassInIrrecoverableBtn" title="Do not shift into irrecoverable"   onClick="com.axelor.apps.account.web.InvoiceController:notPassInIrrecoverable" showIf="irrecoverableStatusSelect == 1"/>
					</panel>
				</panel>
				<panel-dashlet name="showSubrogationReleasePanel" action="action-invoice-view-show-subrogation-release" colSpan="12" showIf="partner.factorizedCustomer"/>
				<field name="partner.factorizedCustomer" hidden="true"/>
			</panel>
			<panel name="advancePaymentPanel" title="Advance payments" showIf="operationSubTypeSelect != 2 &amp;&amp; (statusSelect != 3 || (statusSelect == 3 &amp;&amp;
InvoiceSet.length > 0))"
				   if="__config__.app.getApp('account').getManageAdvancePaymentInvoice()">
				<field name="advancePaymentInvoiceSet" widget="TagSelect"
					   canNew="false"
					   canEdit="false"
					   onSelect="action-invoice-method-create-advance-payment-domain"
					   readonlyIf="statusSelect == 3"
					   form-view="invoice-form" grid-view="invoice-grid"/>
			</panel>
			<panel title="Printing" name="printingPanel" colSpan="12">
				<field name="printingSettings" onSelect="action-invoice-method-filter-printing-settings" canEdit="false"/>
				<field name="invoicesCopySelect" colSpan="6" title="Invoices copy"/>
				<field name="hideDiscount" colSpan="6"/>
        <field name="headOfficeAddress" if="__user__.activeCompany?.accountConfig?.displayHeadOfficeAddrOnInvoicePrinting"/>
        <field name="specificNotes" colSpan="12" readonly="true" showIf="specificNotes"/>
				<field name="displayTimesheetOnPrinting" if-module="axelor-business-project" hidden="true"/>
				<field name="displayExpenseOnPrinting" if-module="axelor-business-project" hidden="true"/>
				<field name="$language" title="Language" type="many-to-one" target="com.axelor.apps.base.db.Language" hidden="true"/>
				<panel name="descriptionToDisplayOnInvoicePanel" title="Comment to display on invoice" colSpan="12">
				  <field name="note" widget="html" colSpan="12" showTitle="false"/>
				</panel>
				<panel name="descriptionToDisplayOnProformaPanel" title="Comment to display on proforma" colSpan="12">
				  <field name="proformaComments" widget="html" colSpan="12" showTitle="false"/>
				</panel>
			</panel>
      <panel name="automaticMailPanel" title="Automatic mail" hideIf="statusSelect == 3 &amp;&amp; !invoiceAutomaticMail &amp;&amp; !invoiceAutomaticMailOnValidate">
        <panel name="afterValidationAutomaticMailPanel" hideIf="statusSelect &gt;= 2 &amp;&amp; !invoiceAutomaticMailOnValidate" colSpan="12">
          <field name="invoiceAutomaticMailOnValidate"/>
          <field name="invoiceMessageTemplateOnValidate" requiredIf="invoiceAutomaticMailOnValidate" showIf="invoiceAutomaticMailOnValidate" domain="self.metaModel.name = 'Invoice'"/>
        </panel>
        <panel  name="afterVentilationAutomaticMailPanel" hideIf="statusSelect &gt;= 3 &amp;&amp; !invoiceAutomaticMail" colSpan="12">
          <field name="invoiceAutomaticMail"/>
          <field name="invoiceMessageTemplate" requiredIf="invoiceAutomaticMail" showIf="invoiceAutomaticMail" domain="self.metaModel.name = 'Invoice'"/>
        </panel>
        <button name="messageBtn" title="Show mail" showIf="[2,3].includes(statusSelect) &amp;&amp; ( invoiceAutomaticMail || invoiceAutomaticMailOnValidate )" onClick="action.message.view.messages" css="btn-custom" colSpan="3"/>
      </panel>
			<panel name="blockingsPanel" title="Blockings" showIf="statusSelect == 3"
				showTitle="false">
				<field name="debitBlockingOk"/>
				<field name="debtRecoveryBlockingOk"/>
				<panel name="debitBlockingGroupPanel" title="Direct debit blocking"  showIf="debitBlockingOk" colSpan="12">
					<field name="debitBlockingByUser" canNew="false" canEdit="false" canView="false"
						form-view="user-form" grid-view="user-grid"/>
					<field name="debitBlockingToDate" />
					<field name="debitBlockingReason" form-view="stop-reason-form" grid-view="stop-reason-grid" />
				</panel>
				<panel showIf="debtRecoveryBlockingOk" name="debtRecoveryBlockingPanel"
					title="Debt recovery blocking" colSpan="12">
					<field name="debtRecoveryBlockingByUser" canNew="false" canEdit="false" canView="false" form-view="user-form" grid-view="user-grid"/>
					<field name="debtRecoveryBlockingToDate"/>
					<field name="debtRecoveryBlockingReason" form-view="stop-reason-form" grid-view="stop-reason-grid" />
				</panel>
			</panel>
			<panel name="invoicePaymentPanel" title="Payments details" showIf="statusSelect != 1">
				<panel name="pfpValidationPanel" colSpan="12" if="__config__.app.getApp('account').getActivatePassedForPayment()" showIf="company.accountConfig.isManagePassedForPayment &amp;&amp; (operationTypeSelect == 1 || (company.accountConfig.isManagePFPInRefund &amp;&amp; operationTypeSelect == 2 ))">
					<field name="pfpValidateStatusSelect" hidden="true" colSpan="4"/>
					<field name="reasonOfRefusalToPayStr" readonly="true" showIf="reasonOfRefusalToPay  &amp;&amp; reasonOfRefusalToPayStr &amp;&amp; pfpValidateStatusSelect == 3" colSpan="12" css="red">
						<viewer><![CDATA[{{record.reasonOfRefusalToPayStr}}]]></viewer>
					</field>
				</panel>
				<panel-related name="invoicePaymentListPanel" title="Payments details" field="invoicePaymentList" colSpan="12"  grid-view="invoice-payment-grid" form-view="invoice-payment-form" canNew="false" canRemove="false"/>
				<panel name="pfpAccountConfigPanel" if="__config__.app.getApp('account').getActivatePassedForPayment()" hidden="true">
					<field name="$isValidPfpValidatorUser" type="boolean"/>
					<field name="$isSelectedPfpValidatorEqualsPartnerPfpValidator"/>
					<field name="reasonOfRefusalToPay"/>
					<field name="company.accountConfig"/>
					<field name="company.accountConfig.isManagePassedForPayment"/>
					<field name="company.accountConfig.isManagePFPInRefund"/>
				</panel>
			</panel>
            <panel name="budgetPanel" title="Budget" showIf="operationTypeSelect == 1 &amp;&amp; statusSelect >= 2 &amp;&amp; statusSelect &lt; 4">
                <panel-dashlet name="budgetDistributionPanel" title="Budget distribution" action="action-budget-distribution-view-budget-distribution" colSpan="12" readonly="true"/>
            </panel>

			<panel  name="directDebitPanel" title="Direct debit" showIf="statusSelect == 3 &amp;&amp; schedulePaymentOk" showTitle="false">
				<panel name="paymentSchedulePanel" title="Payment schedule" colSpan="12" >
					<field name="schedulePaymentOk" readonly="true"/>
					<field name="paymentSchedule" readonly="true" domain="self.company = :company AND self.partner = :partner" form-view="payment-schedule-form" grid-view="payment-schedule-grid"/>
				</panel>
			</panel>
		</panel-tabs>

        <panel name="actionsPanel" hideIf="partner == null" sidebar="true">
            <field name="amountRemaining" hidden="true"/>
            <field name="hasPendingPayments" hidden="true"/>
            <button name="validateBtn" hidden="true" title="Validate" onClick="save,action-validate-invoice-ckeck-invoice-line-tax-list,action-invoice-method-validate"/>
            <button name="ventilateBtn" hidden="true" title="Ventilate" showIf="statusSelect == 2 &amp;&amp; operationSubTypeSelect != 2" onClick="save,action-invoice-method-check-not-lettered-advance-payment-move-lines,action-invoice-method-check-not-imputed-refunds,action-invoice-method-ventilate,save" prompt="Are you sure you want to ventilate the invoice ?"/>
            <button name="validateAndVentilateBtn" hidden="true" title="Validate" onClick="save,action-validate-invoice-ckeck-invoice-line-tax-list,action-validate-invoice-ckeck-invoice-line-tax-list,action-invoice-method-check-not-lettered-advance-payment-move-lines,action-invoice-method-check-not-imputed-refunds,action-invoice-method-validate-and-ventilate"/>
            <button name="passedForPaymentValidationBtn" showIf="company.accountConfig.isManagePassedForPayment &amp;&amp; $isValidPfpValidatorUser &amp;&amp; (operationTypeSelect == 1 || (company.accountConfig.isManagePFPInRefund &amp;&amp; operationTypeSelect == 2 )) &amp;&amp; (statusSelect == 2 || statusSelect == 3) &amp;&amp; [1,3].includes(pfpValidateStatusSelect)" title="Passed for payment validation" onClick="action-invoice-group-pfp-validate" if="__config__.app.getApp('account').getActivatePassedForPayment()"/>
            <button name="refusalToPayBtn" showIf="company.accountConfig.isManagePassedForPayment &amp;&amp; $isValidPfpValidatorUser &amp;&amp; (operationTypeSelect == 1 || (company.accountConfig.isManagePFPInRefund &amp;&amp; operationTypeSelect == 2 ))  &amp;&amp; (statusSelect == 2 || statusSelect == 3) &amp;&amp; pfpValidateStatusSelect == 1" title="Refusal to pay" onClick="save,action-invoice-view-refusal-to-pay" if="__config__.app.getApp('account').getActivatePassedForPayment()"/>
            <button name="cancelBtn" hidden="true" title="Cancel" onClick="save,action-invoice-method-cancel,save" prompt="Are you sure you want to cancel the invoice ?"/>
            <button name="draftBtn" title="Draft" showIf="statusSelect == 4" onClick="save,action-invoice-record-draft,save,action-account-invoice-onload-group"/>
            <button name="addPaymentBtn" title="Register payment" showIf="(statusSelect == 3 || (statusSelect == 2 &amp;&amp; operationSubTypeSelect == 2)) &amp;&amp; amountRemaining > 0 &amp;&amp; !hasPendingPayments &amp;&amp; (operationTypeSelect == 3 || operationTypeSelect == 4 || !company.accountConfig.isManagePassedForPayment || ( (operationTypeSelect == 1 || (!company.accountConfig.isManagePFPInRefund || (company.accountConfig.isManagePFPInRefund &amp;&amp; operationTypeSelect == 2 ))) &amp;&amp; pfpValidateStatusSelect == 2))" colSpan="12" onClick="action-invoice-group-add-invoice-payment" if="!__config__.app.getApp('account').paymentVouchersOnInvoice"/>
            <button name="addPaymentBtn" title="Register payment" showIf="(statusSelect == 3 || (statusSelect == 2 &amp;&amp; operationSubTypeSelect == 2)) &amp;&amp; amountRemaining > 0 &amp;&amp; !hasPendingPayments &amp;&amp; (operationTypeSelect == 3 || operationTypeSelect == 4 || !company.accountConfig.isManagePassedForPayment || ( (operationTypeSelect == 1 || (!company.accountConfig.isManagePFPInRefund || (company.accountConfig.isManagePFPInRefund &amp;&amp; operationTypeSelect == 2 ))) &amp;&amp; pfpValidateStatusSelect == 2))" colSpan="12" onClick="save,action-invoice-view-register-payment-voucher" if="__config__.app.getApp('account').paymentVouchersOnInvoice"/>
            <field name="validatedByUser" hidden="true" showIf="validatedByUser" colSpan="6" canView="false"/>
			<field name="validatedDate" hidden="true" showIf="validatedDate" colSpan="6"/>
			<field name="pfpValidatorUser" hidden="true" if="__config__.app.getApp('account').getActivatePassedForPayment()" showIf="company.accountConfig.isManagePassedForPayment &amp;&amp; (operationTypeSelect == 1 || company.accountConfig.isManagePFPInRefund &amp;&amp; operationTypeSelect == 2) &amp;&amp; statusSelect &gt; 1" readonlyIf="pfpValidateStatusSelect != 1" colSpan="6" onSelect="action-invoice-method-domain-pfp-validator-user-on-select" onChange="action-invoice-method-hide-send-email-pfp-btn,action-invoice-attrs-is-valid-pfp-validator-user" canEdit="false"/>
			<panel name="pfpEmailPanel" if="__config__.app.getApp('account').getActivatePassedForPayment()" colSpan="6">
				<field name="decisionPfpTakenDate" hidden="true"  showIf="company.accountConfig.isManagePassedForPayment &amp;&amp; (operationTypeSelect == 1 || company.accountConfig.isManagePFPInRefund &amp;&amp; operationTypeSelect == 2) &amp;&amp; decisionPfpTakenDate" colSpan="12"/>
				<button name="sendPfpNotifyEmailBtn" hidden="true" showIf="company.accountConfig.isManagePassedForPayment &amp;&amp; (operationTypeSelect == 1 || company.accountConfig.isManagePFPInRefund &amp;&amp; operationTypeSelect == 2) &amp;&amp; pfpValidatorUser &amp;&amp; pfpValidateStatusSelect == 1 &amp;&amp; !$isSelectedPfpValidatorEqualsPartnerPfpValidator  &amp;&amp; statusSelect &gt; 1" colSpan="12" title="Send a notify email" onClick="save,action-send-by-email-with-template"/>
			</panel>
			<field name="ventilatedByUser" hidden="true" showIf="ventilatedByUser" colSpan="6" canView="false"/>
			<field name="ventilatedDate" hidden="true" showIf="ventilatedDate" colSpan="6"/>
        </panel>
        <panel sidebar="true" name="totalsPanel" title="Totals" showTitle="false" itemSpan="6"  hideIf="partner == null">
			<field name="currency.code" hidden="true"/>
			<field name="currency.symbol" hidden="true"/>
			<field name="inTaxTotal" css="order-subtotal" showTitle="false" colSpan="12">
				<viewer depends="exTaxTotal,currency.symbol,taxTotal"><![CDATA[
		         <dl class="dl-horizontal">
		           <dt x-translate>Total W.T.</dt>
		           <dd>{{record.exTaxTotal}} {{record.currency.symbol}}</dd>
		           <dt x-translate>Total tax</dt>
		           <dd>{{record.taxTotal}} {{record.currency.symbol}}</dd>
		           <dt class="order-subtotal-total" x-translate>Total A.T.I.</dt>
		           <dd class="order-subtotal-total">{{record.inTaxTotal}} {{record.currency.symbol}}</dd>
		         </dl>]]>
				</viewer>
			</field>
            <field name="$paymentVouchersOnInvoice" type="boolean" hidden="true" />
            <field name="invoicePaymentList" showTitle="false" readonly="true" colSpan="12" css="order-subtotal">
              <viewer depends="typeSelect,statusSelect,id,paymentDate,amount,currency.symbol,$paymentVouchersOnInvoice">
                <![CDATA[
                  <span class="form-item-container">
                    <dl class="dl-horizontal" ng-class="{'hilite-danger-text': record.statusSelect == 2, 'hilite-info-text': record.statusSelect == 3}">
                      <dt>
                        <a href="#/ds/action-invoice-view-register-payment{{record.$paymentVouchersOnInvoice ? '-voucher':''}}/edit/{{record.id}}">
                          <i class="fa fa-link" ng-class="{'font-black': record.statusSelect == 1, 'hilite-danger-text': record.statusSelect == 2, 'hilite-info-text': record.statusSelect == 3}"></i>
                        </a>
                        <font x-translate ng-if="record.typeSelect == 1 || record.typeSelect == 2">Paid on</font>
                        <font x-translate ng-if="record.typeSelect == 3">Ref. on</font>
                        <font x-translate ng-if="record.typeSelect == 4">Inv. on</font>
                        <font x-translate ng-if="record.typeSelect == 5">Other on</font>
                        <font x-translate ng-if="record.typeSelect == 6">Imputed on</font>
                        <font> {{record.paymentDate | date : 'dd/MM/yyyy'}}</font>
                        <dd>-{{record.amount}} {{record.currency.symbol}}</dd>
                      </dt>
                   	</dl>
                  </span>
                ]]>
              </viewer>
              <editor></editor>
            </field>
			<field name="inTaxTotal" css="order-subtotal" showTitle="false" colSpan="12" showIf="statusSelect == 2 || statusSelect == 3">
				<viewer depends="amountRemaining,currency.symbol"><![CDATA[
		         <dl class="dl-horizontal">
		           <dt class="order-subtotal-total" x-translate>Amount due</dt>
		           <dd class="order-subtotal-total">{{record.amountRemaining}} {{record.currency.symbol}}</dd>
		         </dl>]]>
				</viewer>
			</field>
		</panel>
		<panel name="totalsCompanyCurrencyPanel" title="Totals company currency" showTitle="false" itemSpan="6" sidebar="true" hideIf="partner == null || company == null || currency == null || company.currency.code == currency.code">
			<field name="company.currency.code" hidden="true"/>
			<field name="company.currency.symbol" hidden="true"/>
			<field name="companyInTaxTotalRemaining" hidden="true"/>
			<field name="companyInTaxTotal" showTitle="false" colSpan="12" css="order-subtotal" >
				<viewer depends="companyExTaxTotal,company.currency.symbol,companyTaxTotal,companyInTaxTotal,companyInTaxTotalRemaining"><![CDATA[
		         <dl class="dl-horizontal">
		           <dt x-translate>Total W.T.</dt>
		           <dd>{{record.companyExTaxTotal}} {{record.company.currency.symbol}}</dd>
		           <dt x-translate>Total tax</dt>
		           <dd>{{record.companyTaxTotal}} {{record.company.currency.symbol}}</dd>
		           <dt class="order-subtotal-total" x-translate>Total A.T.I.</dt>
		           <dd class="order-subtotal-total">{{record.companyInTaxTotal}} {{record.company.currency.symbol}}</dd>
					<dt x-translate>Total Amount Remaining</dt>
		           <dd class="order-subtotal-total">{{record.companyInTaxTotalRemaining}} {{record.company.currency.symbol}}</dd>
		         </dl>
		       ]]></viewer>
			</field>
		</panel>

        <panel-stack name="otherDetailsPanel" sidebar="true" hideIf="partner == null">
			<panel name="referenceDocumentsPanel" title="Reference documents" itemSpan="6" canCollapse="true" collapseIf="true">
				<field name="internalReference"/>
				<field name="externalReference"/>
			</panel>
			<panel name="datesPanel" title="Dates" readonlyIf="statusSelect == 3" canCollapse="true" collapseIf="true">
				<field name="invoiceDate" onChange="action-invoice-record-due-date,action-invoice-record-estimated-payment-date" readonlyIf="ventilatedByUser || ventilatedDate"/>
				<field name="dueDate" onChange="action-invoice-record-estimated-payment-date"/>
				<field name="estimatedPaymentDate" readonly="true" if-module="axelor-cash-management"  if="__config__.app.isApp('cash-management')" colSpan="12"/>
			</panel>
		</panel-stack>

		<panel-mail name="mailPanel">
			<mail-messages limit="4" />
			<mail-followers />
		</panel-mail>
	</form>


	<form name="invoice-reports-wizard-form" title="Reports"  model="com.axelor.apps.base.db.Wizard" onNew="action-invoice-reports-wizard-attrs-set-report-type-select">
		<panel name="mainPanel">
			<panel name="invoiceTypePanel" colSpan="6">
				<field name="$reportType" title="Invoice type" type="integer" selection-in="[1]" selection="invoice.report.type" required="true"
					onChange="action-invoice-reports-wizard-attrs-set-format-select"
					showIf="_statusSelect == 1 || (_statusSelect == 2 &amp;&amp; _operationSubTypeSelect != 2)" readonly="true" colSpan="12" />
				<field name="$reportType" title="Invoice type" type="integer" selection-in="[2,3]" selection="invoice.report.type" required="true"
					onChange="action-invoice-reports-wizard-attrs-set-format-select"
					showIf="(_statusSelect == 3  || (_operationSubTypeSelect == 2 &amp;&amp; _statusSelect == 2)) &amp;&amp; _printedPDF == null" colSpan="12"/>
				<field name="$reportType" title="Invoice type" type="integer" selection-in="[2,3,4]" selection="invoice.report.type" colSpan="12"
					required="true" onChange="action-invoice-reports-wizard-attrs-set-format-select"
					showIf="(_statusSelect == 3 || (_operationSubTypeSelect == 2 &amp;&amp; _statusSelect == 2)) &amp;&amp; _printedPDF != null"/>
			</panel>
			<panel name="formatPanel" colSpan="6">
				<field name="$format" title="Format" type="integer" selection="invoice.report.format" colSpan="12" required="true"/>
			</panel>
			<field name="$language" title="Language" type="many-to-one" target="com.axelor.apps.base.db.Language" showIf="$reportType ==1 || $reportType==3"/>
			<button name="printBtn" title="Print" onClick="action-invoice-group-report-print" readonlyIf="$reportType==null || $format==null"/>
		</panel>
	</form>

    <form name="invoice-client-form" title="Invoice" model="com.axelor.apps.account.db.Invoice"
		  onNew="action-account-invoice-onnew-group"
		  onLoad="action-account-invoice-onload-group">

		<toolbar>
			<button name="showInvoiceBtn" title="Print" icon="fa-print" onClick="save,action-invoice-method-show-invoice"/>
			<button name="showAnnexBtn" title="Print annex" icon="fa-print" onClick="action-invoice-business-project-method-print-annex" if-module="axelor-business-project"
				showIf="partner != null &amp;&amp; (displayTimesheetOnPrinting || displayExpenseOnPrinting)"/>
		</toolbar>

		<panel name="mainPanel" >
			<field name="invoiceId"/>

			<field name="statusSelect" widget="NavSelect"/>
			<panel name="operationTypeDetailsPanel" itemSpan="12" colSpan="6">
				<field name="operationTypeSelect" selection="iinvoice.operation.type.select" readonlyIf="statusSelect &gt; 1" showTitle="false" onChange="action-group-account-invoice-operationtype-onchange">
					<viewer>
						<![CDATA[

			 			<h3>
			             <span class="label label-important" ng-if="operationTypeSelect = 1" x-translate ng-show="record.operationTypeSelect == 1">Supplier purchase</span>
			             <span class="label label-important" ng-if="operationTypeSelect = 2" x-translate ng-show="record.operationTypeSelect == 2">Supplier refund</span>
			             <span class="label label-important" ng-if="operationTypeSelect = 3" x-translate ng-show="record.operationTypeSelect == 3">Customer sale</span>
			             <span class="label label-important" ng-if="operationTypeSelect = 4" x-translate ng-show="record.operationTypeSelect == 4">Customer refund</span>
			           </h3>

					]]>
					</viewer>
				</field>

			</panel>
			<field name="company" widget="SuggestBox" onChange="action-group-account-invoice-company-onchange" form-view="company-form" grid-view="company-grid" readonlyIf="statusSelect != 1"/>
			<field name="companyBankDetails" canEdit="false" widget="SuggestBox" onSelect="action-invoice-attrs-domain-company-bank-details" form-view="bank-details-form" grid-view="bank-details-grid"/>
			<field name="currency" canEdit="false" onChange="action-invoice-attrs-change-total-title" readonlyIf="statusSelect != 1" form-view="currency-form" grid-view="currency-grid"/>
			<field name="project" if-module="axelor-business-project" onSelect="action-invoice-attrs-domain-project" form-view="project-form" grid-view="project-grid" if="__config__.app.isApp('project')"/>
			<field name="inAti" onChange="action-invoice-attrs-in-ati"/>
		</panel>

		<panel name="invoicingInfoPanel" title="Invoicing informations">
			<field name="partner" canEdit="false" form-view="partner-form" grid-view="partner-grid" readonlyIf="((operationTypeSelect == 3 || operationTypeSelect == 4) &amp;&amp; statusSelect != 1) || ((operationTypeSelect == 1 || operationTypeSelect == 2) &amp;&amp; (statusSelect !=1 || invoiceLineList.length > 0))" onChange="action-group-account-invoice-partner-onchange,action-method-invoice-address-str" onSelect="action-invoice-method-set-partner-domain" canView="false"/>
			<field name="contactPartner" canEdit="false" onSelect="action-set-partner-domain" domain="self.isContact = true AND :company member of self.companySet" form-view="partner-contact-form" grid-view="partner-contact-grid"
				   readonlyIf="partner != null &amp;&amp; partner.partnerTypeSelect == 2" canView="false"/>
			<field name="$partnerBankDetailsListWarning" showTitle="false" hidden="true" readonly="true" colSpan="12">
      			<viewer><![CDATA[
               		<span x-translate style="color:red">Watch out, this partner has no active bank details</span>
           		]]></viewer>
    		</field>
			<panel name="addressDetailsPanel" stacked="true">
				<field name="address" hideIf="$readonly() || statusSelect &gt; 1" onSelect="action-invoice-attrs-domain-address" onChange="action-method-invoice-address-str" form-view="address-partner-address-form" canEdit="false" canNew="true"/>
				<field name="addressStr" readonlyIf="statusSelect &gt; 1" height="5">
					<viewer>{{record.addressStr}}</viewer>
				</field>
			</panel>
			<field name="paymentMode" canEdit="false" grid-view="payment-mode-grid" form-view="payment-mode-form" widget="SuggestBox" onSelect="action-set-payment-mode-domain" onChange="action-invoice-method-fill-company-bank-details,action-invoice-method-check-partner-bank-details-list"/>
			<field name="paymentCondition" canEdit="false" readonlyIf="statusSelect == 3" widget="SuggestBox" onChange="action-invoice-record-due-date" form-view="payment-condition-form" grid-view="payment-condition-grid"/>
			<field name="bankDetails" canEdit="false" widget="SuggestBox" onSelect="action-invoice-attrs-bank-details-from-partner-domain" form-view="bank-details-form" grid-view="bank-details-grid"/>
			<field name="partnerTaxNbr" readonlyIf="statusSelect != 1" hideIf="operationTypeSelect != 3 &amp;&amp; operationTypeSelect != 4" if-module="axelor-supplychain" if="__config__.app.isApp('supplychain')"/>
			<field name="supplierInvoiceNb" showIf="operationTypeSelect == 1 || operationTypeSelect == 2"/>
		</panel>

		<panel-tabs name="invoiceDetails">
			<panel name="invoiceContentPanel" title="Invoice content" showTitle="false">
				<panel-related name="invoiceLineListPanel" field="invoiceLineList" canNew="statusSelect == 1" canRemove="statusSelect == 1" readonlyIf="statusSelect == 3 || partner == null" colSpan="12" form-view="invoice-line-client-form" grid-view="invoice-line-grid" onChange="action-invoice-method-compute" canMove="true" orderBy="sequence"/>
				<panel-related name="invoiceLineTaxListPanel" field="invoiceLineTaxList" colSpan="12" form-view="invoice-line-tax-form" grid-view="invoice-line-tax-grid"/>
			</panel>
		</panel-tabs>

		<panel-stack name="otherDetailsPanel" sidebar="true">
			<panel name="referenceDocumentsPanel" title="Reference documents" itemSpan="6">
				<field name="internalReference"/>
				<field name="externalReference"/>
			</panel>
			<panel name="datesPanel" title="Dates" readonlyIf="statusSelect == 3">
				<field name="invoiceDate" onChange="action-invoice-record-due-date,action-invoice-record-estimated-payment-date" />
				<field name="dueDate" onChange="action-invoice-record-estimated-payment-date"/>
				<field name="estimatedPaymentDate" readonly="true" if-module="axelor-cash-management"  if="__config__.app.isApp('cash-management')" />
			</panel>
		</panel-stack>

	    <panel sidebar="true" name="actionsPanel" title="Actions" >
	        <button name="validateBtn" title="Validate" showIf="statusSelect == 1" onClick="save,action-validate-invoice-ckeck-invoice-line-tax-list,action-invoice-method-validate"/>
	        <button name="ventilateBtn" title="Ventilate" showIf="statusSelect == 2" onClick="save,action-invoice-method-ventilate,save" prompt="Are you sure you want to ventilate the invoice ?"/>
	        <button name="cancelBtn" title="Cancel" onClick="save,action-invoice-method-cancel,save" prompt="Are you sure you want to cancel the invoice ?"/>
	        <button name="draftBtn" title="Draft" showIf="statusSelect == 4" onClick="save,action-invoice-record-draft,save"/>
        	<button name="addPaymentBtn" title="Register payment" showIf="statusSelect == 3 &amp;&amp; amountRemaining > 0 &amp;&amp; !hasPendingPayments" colSpan="12" onClick="action-invoice-group-add-invoice-payment" if="!__config__.app.getApp('account').paymentVouchersOnInvoice"/>
            <button name="addPaymentBtn" title="Register payment" showIf="statusSelect == 3 &amp;&amp; amountRemaining > 0 &amp;&amp; !hasPendingPayments" colSpan="12" onClick="save,action-invoice-view-register-payment-voucher" if="__config__.app.getApp('account').paymentVouchersOnInvoice"/>
            <field name="amountRemaining" hidden="true"/>
            <field name="hasPendingPayments" hidden="true"/>
			<field name="validatedByUser" hidden="true" showIf="validatedByUser" colSpan="6" canView="false"/>
			<field name="validatedDate" hidden="true" showIf="validatedDate" colSpan="6"/>
			<field name="ventilatedByUser" hidden="true" showIf="ventilatedByUser" colSpan="6" canView="false"/>
			<field name="ventilatedDate" hidden="true" showIf="ventilatedDate" colSpan="6"/>
	    </panel>

		<panel sidebar="true" name="totalsPanel" title="Totals" itemSpan="6">
			<field name="currency.symbol" hidden="true"/>
			<field name="inTaxTotal" css="order-subtotal" showTitle="false" colSpan="12">
				<viewer depends="exTaxTotal,currency.symbol,taxTotal,inTaxTotal"><![CDATA[
		         <dl class="dl-horizontal">
		           <dt x-translate>Total W.T.</dt>
		           <dd>{{record.exTaxTotal}} {{record.currency.symbol}}</dd>
		           <dt x-translate>Total tax</dt>
		           <dd>{{record.taxTotal}} {{record.currency.symbol}}</dd>
		           <dt class="order-subtotal-total" x-translate>Total A.T.I.</dt>
		           <dd class="order-subtotal-total">{{record.inTaxTotal}} {{record.currency.symbol}}</dd>
		         </dl>]]>
				</viewer>
			</field>
            <field name="$paymentVouchersOnInvoice" type="boolean" hidden="true" />
            <field name="invoicePaymentList" showTitle="false" readonly="true" colSpan="12" css="order-subtotal">
              <viewer depends="typeSelect,statusSelect,id,paymentDate,amount,currency.symbol,$paymentVouchersOnInvoice">
                <![CDATA[
                  <span class="form-item-container">
                    <dl class="dl-horizontal" ng-class="{'hilite-danger-text': record.statusSelect == 2, 'hilite-info-text': record.statusSelect == 3}">
                      <dt>
                        <a href="#/ds/action-invoice-view-register-payment{{record.$paymentVouchersOnInvoice ? '-voucher':''}}/edit/{{record.id}}">
                          <i class="fa fa-link" ng-class="{'font-black': record.statusSelect == 1, 'hilite-danger-text': record.statusSelect == 2, 'hilite-info-text': record.statusSelect == 3}"></i>
                        </a>
                        <font x-translate ng-if="record.typeSelect == 1 || record.typeSelect == 2">Paid on</font>
                        <font x-translate ng-if="record.typeSelect == 3">Ref. on</font>
                        <font x-translate ng-if="record.typeSelect == 4">Inv. on</font>
                        <font x-translate ng-if="record.typeSelect == 5">Other on</font>
                        <font x-translate ng-if="record.typeSelect == 6">Imputed on</font>
                        <font> {{record.paymentDate | date : 'dd/MM/yyyy'}}</font>
                        <dd>-{{record.amount}} {{record.currency.symbol}}</dd>
                      </dt>
                   	</dl>
                  </span>
                ]]>
              </viewer>
            </field>
			<field name="inTaxTotal" css="order-subtotal" showTitle="false" colSpan="12" showIf="statusSelect == 2 || statusSelect == 3">
				<viewer depends="amountRemaining,currency.symbol"><![CDATA[
		         <dl class="dl-horizontal">
		           <dt class="order-subtotal-total" x-translate>Amount due</dt>
		           <dd class="order-subtotal-total">{{record.amountRemaining}} {{record.currency.symbol}}</dd>
		         </dl>]]>
				</viewer>
			</field>
		</panel>
	</form>



    <!-- invoice-account  -->
    <grid name="invoice-account-grid" title="Invoices" model="com.axelor.apps.account.db.Invoice">
		<field name="invoiceId"/>
		<field name="operationTypeSelect"/>
		<field name="operationSubTypeSelect"/>
		<field name="paymentMode" grid-view="payment-mode-grid" form-view="payment-mode-form" />
		<field name="invoiceDate"/>
		<field name="dueDate"/>
		<field name="inTaxTotal" aggregate="sum"/>
		<field name="amountRemaining" aggregate="sum"/>
		<field name="currency"/>
		<field name="statusSelect"/>
    </grid>

    <!-- invoice-direct-debit  -->
    <grid name="invoice-direct-debit-grid" title="Debited invoices" model="com.axelor.apps.account.db.Invoice">
		<field name="invoiceId"/>
		<field name="partner" form-view="partner-form" grid-view="partner-grid"/>
		<field name="operationTypeSelect"/>
		<field name="operationSubTypeSelect"/>
		<field name="paymentMode" grid-view="payment-mode-grid" form-view="payment-mode-form" />
		<field name="invoiceDate"/>
		<field name="dueDate"/>
		<field name="inTaxTotal" aggregate="sum"/>
		<field name="directDebitAmount" aggregate="sum"/>
		<field name="currency"/>
		<field name="statusSelect"/>
    </grid>

	<!-- VIEW LITE  -->
    <grid name="invoice-lite-grid" title="Invoices" model="com.axelor.apps.account.db.Invoice">
    	<toolbar>
        	<button name="newBtn" title="" hidden="true"/>
    		<button name="saveBtn" title="" hidden="true"/>
    		<button name="copyBtn" title="" hidden="true"/>
    		<button name="deleteBtn" title="" hidden="true"/>
		</toolbar>
        <field name="invoiceId"/>
        <field name="invoiceDate"/>
		<field name="operationTypeSelect"/>
		<field name="operationSubTypeSelect"/>
		<field name="statusSelect"/>
    </grid>

	<grid model="com.axelor.apps.account.db.Invoice" title="Release details"
		name="invoice-release-details-grid" orderBy="invoiceDate, dueDate, invoiceId">
		<hilite background="danger" if="$subrogationStatusSelect == 3 &amp;&amp; amountRemaining &gt; 0"/>
		<field name="invoiceId" width="120"/>
		<field name="partner.partnerSeq" width="120"/>
		<field name="partner.name" />
		<field name="invoiceDate" />
		<field name="dueDate" />
		<field name="inTaxTotal" />
		<field name="currency" />
		<field name="$subrogationStatusSelect" hidden="true"/>
		<field name="amountRemaining" hidden="true"/>
	</grid>

    <!-- CUSTOMER INVOICES MERGE  -->
    <form name="customer-invoices-merge-form" model="com.axelor.apps.base.db.Wizard" title="Merge Cust. Invoices" width="large">
		<panel-related name="$invoiceToMergePanel" field="$invoiceToMerge" form-view="invoice-form" grid-view="invoice-grid" title="Cust. Invoices to merge" colSpan="12" type="many-to-many" target="com.axelor.apps.account.db.Invoice" domain="self.statusSelect = 1 AND self.operationTypeSelect = 3" canNew="false" canEdit="false" />
		<panel name="actionsPanel" sidebar="true" title="Actions">
			<button name="generateMergedCustInvoicesBtn" title="Merge into single cust. invoice" onClick="action-validate-invoice-check-selection,action-group-invoice-merge-action"/>
	  	</panel>
    </form>

    <form name="customer-invoices-merge-confirm-form" model="com.axelor.apps.base.db.Wizard" title="Confirmation" onNew="action-record-load-dummy-field-confirm-merge-invoice">
		<panel name="mainPanel" colSpan="6" colOffset="3">
            <field name="contactPartnerToCheck" hidden="true" colOffset="12" />
            <field name="priceListToCheck" hidden="true" colOffset="12" />
            <field name="paymentModeToCheck" hidden="true" colOffset="12" />
            <field name="paymentConditionToCheck" hidden="true" colOffset="12" />
			<field name="$contactPartner" title="Contact partner" type="many-to-one" target="com.axelor.apps.base.db.Partner" domain="self.isContact IS TRUE AND :company member of self.companySet AND EXISTS (SELECT 1 FROM Partner part WHERE part.id = :partnerId AND self.id IN (SELECT id FROM part.contactPartnerSet))" colSpan="6" colOffset="3" width="200px" widget="SuggestBox" showIf="contactPartnerToCheck" form-view="partner-contact-form" grid-view="partner-contact-grid"/>
			<field name="$priceList" title="Price List" type="many-to-one" target="com.axelor.apps.base.db.PriceList" domain="self.typeSelect = 2 and self.isActive = true" colSpan="6" colOffset="3" width="200px" showIf="priceListToCheck" canSelect="true" form-view="price-list-form" grid-view="price-list-grid"/>
			<field name="$paymentMode" title="Payment Mode" type="many-to-one" target="com.axelor.apps.account.db.PaymentMode"  colSpan="6" colOffset="3" width="200px" widget="SuggestBox" showIf="paymentModeToCheck" form-view="payment-mode-form" grid-view="payment-mode-grid"/>
			<field name="$paymentCondition" title="Payment Condition" type="many-to-one" target="com.axelor.apps.account.db.PaymentCondition"  colSpan="6" colOffset="3" width="200px" widget="SuggestBox" showIf="paymentConditionToCheck" form-view="payment-condition-form" grid-view="payment-condition-grid"/>
			<button name="confirmBtn" title="Confirm" onClick="action-group-invoice-merge-action" colSpan="12" width="200px"/>
		</panel>
    </form>

	<form name="invoice-refusal-to-pay-wizard-form" model="com.axelor.apps.account.db.Invoice" title="Cancellation confirmation" >
		<panel name="mainPanel">
			<field name="reasonOfRefusalToPay" domain="self.applicationType = :_xApplicationType" colOffset="4" colSpan="4" widget="SuggestBox" canNew="false" canEdit="false" onChange="action-attrs-invoice-other-reason"/>
			<field name="reasonOfRefusalToPayStr" colOffset="4" colSpan="4" hidden="true"/>
			<button name="cancelConfirmBtn" title="Confirm cancellation" onClick="action-invoice-refusal-to-pay-cancel-reason-check,action-invoice-method-refusal-to-pay" colOffset="4" colSpan="4"/>
		</panel>
    </form>

    <action-group name="action-group-invoice-merge-action">
	    <action name="action-invoice-method-merge-account" if="__repo__(MetaModule).all().filter('self.name = ?','axelor-supplychain').fetchOne()?.installed == false"/>
	    <action name="action-invoice-method-merge-supplychain" if="__repo__(MetaModule).all().filter('self.name = ?','axelor-supplychain').fetchOne()?.installed == true &amp;&amp; __repo__(MetaModule).all().filter('self.name = ?','axelor-business-project').fetchOne()?.installed == false"/>
	    <action name="action-invoice-method-merge-business-project" if="__repo__(MetaModule).all().filter('self.name = ?','axelor-business-project').fetchOne()?.installed == true"/>

	</action-group>

    <action-group name="action-account-invoice-onnew-group">
	    <action name="action-invoice-record-default"/>
		  <action name="action-invoice-method-payment-mode-condition" if="company != null"/>
	    <action name="action-invoice-method-fill-company-bank-details"/>
	    <action name="action-invoice-attrs-collapse-irrecoverable-group"/>
	    <action name="action-invoice-record-in-ati"/>
	    <action name="action-invoice-attrs-in-ati"/>
		  <action name="action-invoice-attrs-hidden-bank-details"/>
		  <action name="action-invoice-method-fill-advance-payment-set"/>
      <action name="action-invoice-attrs-show-validate-button"/>
			<action name="action-invoice-attrs-interco-supplychain"/>
			<action name="action-invoice-record-interco-supplychain"/>
			<action name="action-invoice-attrs-change-create-refund-title"/>
	    <action name="action-invoice-record-printing-fields" if="__config__.app.isApp('business-project')"/>
			<action name="action-invoice-record-load-dummy-field-payment-voucher-on-invoice"/>
      <action name="action-invoice-record-set-dummy-field-language"/>
    </action-group>

    <action-group name="action-account-invoice-onload-group" >
	    <action name="action-invoice-attrs-hide-cancel-button"/>
	    <action name="action-invoice-attrs-collapse-irrecoverable-group"/>
	    <action name="action-invoice-attrs-in-ati"/>
	    <action name="action-invoice-attrs-printing-fields"/>
      <action name="action-invoice-attrs-hidden-bank-details"/>
      <action name="action-invoice-attrs-show-validate-button"/>
			<action name="action-invoice-attrs-interco-supplychain"/>
			<action name="action-invoice-attrs-change-create-refund-title"/>
      <action name="action-invoice-record-load-dummy-field-payment-voucher-on-invoice"/>
      <action name="action-account-invoice-atts-suppier-invoice-nbr"/>
      <action name="action-invoice-method-check-partner-bank-details-list"/>
      <action name="action-invoice-attrs-is-valid-pfp-validator-user" if="__config__.app.getApp('account').getActivatePassedForPayment() &amp;&amp; (company.accountConfig.isManagePassedForPayment &amp;&amp; (operationTypeSelect == 1 || company.accountConfig.isManagePFPInRefund &amp;&amp; operationTypeSelect == 2)) "/>
    	<action name="action-invoice-method-hide-send-email-pfp-btn" if="__config__.app.getApp('account').getActivatePassedForPayment() &amp;&amp; (company.accountConfig.isManagePassedForPayment &amp;&amp; (operationTypeSelect == 1 || company.accountConfig.isManagePFPInRefund &amp;&amp; operationTypeSelect == 2)) "/>
      <action name="action-invoice-record-set-dummy-field-language"/>
    </action-group>

    <action-group name="action-group-account-invoice-operationtype-onchange">
		<action name="action-invoice-method-payment-mode-condition"/>
    	<action name="action-invoice-record-partner-change"/>
    </action-group>

    <action-group name="action-group-account-invoice-company-onchange">
    	<action name="action-invoice-method-fill-company-bank-details"/>
        <action name="action-invoice-record-specific-note-on-invoice"/>
    	<action name="action-invoice-attrs-hide-cancel-button"/>
        <action name="action-invoice-record-update-info-company"/>
        <action name="action-invoice-record-set-dummy-field-language"/>
    </action-group>

    <action-group name="action-group-account-invoice-partner-onchange">
    	<action name="action-invoice-record-partner-change"/>
		  <action name="action-invoice-method-payment-mode-condition"/>
    	<action name="action-invoice-record-due-date"/>
    	<action name="action-invoice-record-estimated-payment-date"/>
			<action name="action-invoice-method-fill-company-bank-details"/>
			<action name="action-invoice-record-specific-note-on-invoice"/>
			<action name="action-invoice-method-fill-advance-payment-set"/>
			<action name="action-invoice-method-set-default-mail"/>
			<action name="action-invoice-method-fill-price-list"/>
			<action name="action-invoice-attrs-interco-supplychain"/>
			<action name="action-invoice-record-interco-supplychain"/>
			<action name="action-invoice-method-check-partner-bank-details-list"/>
			<action name="action-invoice-method-set-pfp-validator-user"
        if="__config__.app.getApp('account').getActivatePassedForPayment() &amp;&amp; (company.accountConfig.isManagePassedForPayment &amp;&amp; (operationTypeSelect == 1 || company.accountConfig.isManagePFPInRefund &amp;&amp; operationTypeSelect == 2) ) "/>
      <action name="action-invoice-record-set-dummy-field-language"/>
    </action-group>

	<action-group name="action-invoice-group-currency-onchange">
		<action name="action-invoice-attrs-change-total-title"/>
		<action name="action-invoice-method-fill-advance-payment-set"/>
	</action-group>

	<action-group name="action-invoice-group-saleorder-onchange">
		<action name="action-invoice-method-fill-in-lines"/>
		<action name="action-invoice-method-fill-advance-payment-set"/>
	</action-group>

	<action-group name="action-invoice-group-invoice-line-onchange">
		<action name="action-invoice-method-remove-subline"/> 
		<action name="save" if="invoiceLineList.find{it->it.typeSelect == 2 &amp;&amp; (it.version != null || it.id == null)} != null" />
		<action name="action-invoice-method-add-subline"/>
		<action name="action-invoice-method-compute"/>
		<action name="save" if="invoiceLineList.find{it->it.typeSelect == 2 &amp;&amp; (it.version != null || it.id == null)} != null" />
	</action-group>

	<action-group name="action-invoice-group-report-print">
		<action name="action-invoice-method-show-invoice" if="reportType != null &amp;&amp; reportType != 4"/>
		<action name="action-invoice-validate-regenerate-invoice" if="reportType != null &amp;&amp; reportType == 4"/>
		<action name="action-invoice-method-regenerate-and-show-invoice" if="reportType != null &amp;&amp; reportType == 4"/>
	</action-group>


	<action-group name="action-invoice-group-pfp-validate">
		<action name="save"/>
		<action name="action-invoice-validate-pfp-stock-move" if="__config__.app.isApp('supplychain') &amp;&amp; __config__.app.getApp('supplychain').getGenerateInvoiceFromStockMove()"/>
		<action name="action-invoice-record-pfp-validate"/>
		<action name="save"/>
	</action-group>


	<action-group name="action-invoice-group-add-invoice-payment">
		<action name="save"/>
		<action name="action-invoice-view-register-payment"/>
	</action-group>

	<action-attrs name="action-invoice-attrs-in-ati">
    	<attribute name="hidden" for="invoiceLineList.exTaxTotal" expr="inAti"/>
    	<attribute name="hidden" for="invoiceLineList.price" expr="inAti"/>
    	<attribute name="hidden" for="invoiceLineList.inTaxTotal" expr="!inAti"/>
    	<attribute name="hidden" for="invoiceLineList.inTaxPrice" expr="!inAti"/>
    	<attribute name="hidden" for="inAti" expr=" eval: __repo__(AccountConfig).all().filter('self.company = ?',company).fetchOne()?.invoiceInAtiSelect == 1
										|| __repo__(AccountConfig).all().filter('self.company = ?',company).fetchOne()?.invoiceInAtiSelect == 2"/>
    </action-attrs>

    <action-attrs name="action-invoice-attrs-domain-project">
    	<attribute name="domain" for="project" expr="eval: &quot; self.clientPartner.id = ${partner?.id} AND self.isBusinessProject = true &quot;" if="operationTypeSelect == 3 || operationTypeSelect == 4"/>
    	<attribute name="domain" for="project" expr="eval: &quot; self.isBusinessProject = true &quot;" if="operationTypeSelect == 1 || operationTypeSelect == 2"/>
    </action-attrs>

    <action-attrs name="action-invoice-attrs-domain-stock-move">
      <attribute name="domain" for="stockMoveSet" expr="eval: &quot;self.partner = :partner AND self.company = :company AND self.statusSelect = 3 AND self.typeSelect = 2&quot;" if="operationTypeSelect == 3 || operationTypeSelect == 4"/>
      <attribute name="domain" for="stockMoveSet" expr="eval: &quot;self.partner = :partner AND self.company = :company AND self.statusSelect = 3 AND self.typeSelect = 3&quot;" if="operationTypeSelect == 1 || operationTypeSelect == 2"/>
    </action-attrs>

	<!-- ACTION RECORD -->

	<action-record name="action-invoice-record-estimated-payment-date" model="com.axelor.apps.account.db.Invoice" if-module="axelor-cash-management">
		<field name="estimatedPaymentDate" expr="eval: dueDate?.plusDays(partner?.paymentDelay?.intValue())" if="__config__.app.isApp('cash-management')" />
	</action-record>

	<action-record name="action-invoice-record-hide-discount" model="com.axelor.apps.account.db.Invoice">
		<field name="hideDiscount" expr="eval: priceList?.hideDiscount"/>
	</action-record>

	<action-record name="action-invoice-record-in-ati" model="com.axelor.apps.account.db.Invoice">
		<field name="inAti" expr="eval: __repo__(AccountConfig).all().filter('self.company = ?',company).fetchOne()?.invoiceInAtiSelect == 2
										|| __repo__(AccountConfig).all().filter('self.company = ?',company).fetchOne()?.invoiceInAtiSelect == 4"/>
	</action-record>

    <action-record name="action-invoice-record-default" model="com.axelor.apps.account.db.Invoice">
    	<field name="exTaxTotal" expr="eval: 0"/>
    	<field name="taxTotal" expr="eval: 0"/>
    	<field name="inTaxTotal" expr="eval: 0"/>
    	<field name="amountPaid" expr="eval: 0"/>
    	<field name="companyExTaxTotal" expr="eval: 0"/>
    	<field name="companyTaxTotal" expr="eval: 0"/>
    	<field name="companyInTaxTotal" expr="eval: 0"/>
    	<field name="companyInTaxTotalRemaining" expr="eval: 0"/>
        <field name="currency" expr="eval:__repo__(User).find(__user__.id)?.activeCompany?.currency" />
        <field name="operationTypeSelect" expr="eval: _operationTypeSelect" if="_operationTypeSelect"/>
        <field name="operationSubTypeSelect" expr="eval: _operationSubTypeSelect" if="_operationSubTypeSelect"/>
        <field name="company"  expr="eval:__user__.activeCompany" if="__user__.activeCompany != null"/>
    	<field name="company"  expr="eval:__repo__(Company).all().fetchOne()" if="__user__.activeCompany == null &amp;&amp; __repo__(Company).all().fetch().size == 1"/>
		<field name="printingSettings" expr="eval: __user__.activeCompany?.printingSettings" if="__user__.activeCompany != null"/>
    </action-record>

    <action-record name="action-invoice-record-load-dummy-field-payment-voucher-on-invoice" model="com.axelor.apps.account.db.Invoice">
        <field name="$paymentVouchersOnInvoice" expr="eval: __config__.app.getApp('account').paymentVouchersOnInvoice"/>
    </action-record>

    <action-record name="action-invoice-record-partner-change" model="com.axelor.apps.account.db.Invoice">
    	<field name="paymentCondition" expr="eval: partner?.paymentCondition"/>
		<field name="address" expr="call:com.axelor.apps.base.service.PartnerService:getInvoicingAddress(partner)"/>
    	<field name="currency" expr="eval: partner?.currency"/>
		<field name="bankDetails" expr="eval: partner?.bankDetailsList.find{ it -&gt; it.isDefault &amp;&amp; it.active} ? partner?.bankDetailsList.find{ it -&gt; it.isDefault &amp;&amp; it.active} : null" />
    	<field name="contactPartner" expr="eval: partner?.contactPartnerSet?.size() == 1 ? partner?.contactPartnerSet[0] : null" />
    	<field name="invoicesCopySelect" expr="eval: partner?.invoicesCopySelect"/>
    	<field name="project" expr="eval: null"/>
    	<field name="purchaseOrder" expr="eval: null"/>
    	<field name="partnerTaxNbr" expr="eval: partner?.taxNbr"/>
    	<field name="proformaComments" expr="eval: partner?.proformaComments"/>
    	<field name="note" expr="eval: partner?.invoiceComments"/>
      <field name="headOfficeAddress" expr="eval: partner?.headOfficeAddress"/>
    </action-record>

    <action-record name="action-invoice-record-reset-suboperationtype" model="com.axelor.apps.account.db.Invoice">
        <field name="operationSubTypeSelect" expr="eval: 1"/>
    </action-record>

    <action-record name="action-invoice-record-due-date" model="com.axelor.apps.account.db.Invoice">
    	<field name="dueDate" expr="call: com.axelor.apps.account.service.invoice.InvoiceToolService:getDueDate(paymentCondition,originDate)" if="paymentCondition != null &amp;&amp; originDate != null &amp;&amp; (operationTypeSelect == 1 || operationTypeSelect == 2) "/>
    	<field name="dueDate" expr="call: com.axelor.apps.account.service.invoice.InvoiceToolService:getDueDate(paymentCondition,invoiceDate)" if="paymentCondition != null &amp;&amp; invoiceDate != null &amp;&amp; (operationTypeSelect == 3 || operationTypeSelect == 4)"/>
    </action-record>

    <action-record name="action-invoice-record-draft" model="com.axelor.apps.account.db.Invoice">
    	<field name="statusSelect" expr="eval: __repo__(Invoice).STATUS_DRAFT"/>
    </action-record>

	<action-record name="action-record-load-dummy-field-confirm-merge-invoice" model="com.axelor.apps.base.db.Wizard">
		<field name="contactPartnerToCheck" expr="eval: contextContactPartnerToCheck"/>
		<field name="partnerId" expr="eval: contextPartnerId"/>
		<field name="priceListToCheck" expr="eval: contextPriceListToCheck"/>
		<field name="paymentModeToCheck" expr="eval: contextPaymentModeToCheck"/>
		<field name="paymentConditionToCheck" expr="eval: contextPaymentConditionToCheck"/>
	</action-record>

	<action-record name="action-invoice-record-interco-supplychain"
				   model="com.axelor.apps.account.db.Invoice" if-module="axelor-supplychain">
		<field name="interco" expr="eval: __config__.app.getApp('supplychain')?.intercoFromInvoice
            &amp;&amp; !createdByInterco &amp;&amp; partner &amp;&amp; __repo__(Company).all().filter('self.partner = ?', partner).fetchOne()"/>
	</action-record>

    <action-record name="action-invoice-record-reset-operationsubtype" model="com.axelor.apps.account.db.Invoice">
        <field name="operationSubTypeSelect" expr="eval: null"/>
    </action-record>

	<action-record name="action-invoice-record-specific-note-on-invoice" model="com.axelor.apps.account.db.Invoice">
		<field name="note" expr="eval: (note ? note + &quot;&lt;br&gt;&quot; : '') + (companyBankDetails?.specificNoteOnInvoice ?: '')"/>
	</action-record>

	<action-record name="action-invoice-record-pfp-validate" model="com.axelor.apps.account.db.Invoice">
		<field name="pfpValidateStatusSelect" expr="eval: 2"/>
		<field name="decisionPfpTakenDate" expr="eval: __date__"/>
	</action-record>

	<action-record name="action-invoice-record-refusal-to-pay" model="com.axelor.apps.account.db.Invoice">
		<field name="pfpValidateStatusSelect" expr="eval: 3"/>
		<field name="decisionPfpTakenDate" expr="eval: __date__"/>
		<field name="reasonOfRefusalToPayStr" expr="eval: reasonOfRefusalToPay?.name"/>
	</action-record>

	<action-record name="action-invoice-record-set-dummy-field-language" model="com.axelor.apps.account.db.Invoice">
		<field name="$language" expr="eval: (__repo__(AccountConfig).all().filter('self.company = ?',company).fetchOne()?.getIsPrintInvoicesInCompanyLanguage()) ? company?.language : partner?.language"/>
	</action-record>

    <!-- ACTION ATTRS -->

    <action-attrs name="action-invoice-attrs-bank-details-from-partner-domain">
		<attribute name="domain" for="bankDetails" expr="eval: &quot; self = null&quot;"/>
    	<attribute name="domain" for="bankDetails" expr="eval: &quot; self.id IN (${partner.bankDetailsList.collect{it.id}.join(',')}) AND self.active = true &quot;" if="partner?.bankDetailsList &amp;&amp; !partner.bankDetailsList.isEmpty()"/>
    </action-attrs>

    <action-attrs name="action-invoice-attrs-hide-cancel-button">
    	<attribute name="hidden" for="cancelBtn" expr="(operationSubTypeSelect == 2 &amp;&amp; statusSelect == 2) || statusSelect == 4 || (statusSelect == 3 &amp;&amp; !company?.accountConfig?.allowCancelVentilatedInvoice)"/>
    </action-attrs>
	
	<action-attrs name="action-set-partner-domain">
		<attribute for="contactPartner" name="domain" expr="eval: &quot;self = null&quot;"/>
		<attribute for="contactPartner" name="domain" expr="eval: &quot;self.id IN (${partner.contactPartnerSet?.collect{it.id}.join(',')}) AND :company member of self.companySet&quot;" if="partner?.contactPartnerSet &amp;&amp; !partner.contactPartnerSet.isEmpty()"/>
	</action-attrs>
			
	<action-method name="action-invoice-method-set-partner-domain">
        <call class="com.axelor.apps.account.web.InvoiceController" method="getInvoicePartnerDomain"/>
	</action-method>

	<action-attrs name="action-invoice-attrs-collapse-irrecoverable-group">
		<attribute name="collapse" for="irrecoverableGroup" expr="eval: irrecoverableStatusSelect == null || irrecoverableStatusSelect == 0"/>
	</action-attrs>

	<action-attrs name="action-invoice-attrs-change-total-title">
		<attribute name="title" for="accountingTotalGroup" expr="eval: 'Totaux en devise comptable (${:self.currency.symbol})'"/>
		<attribute name="title" for="invoiceTotalGroup" expr="eval: 'Totaux en devise de la facture (${:self.partner.currency.symbol})'"/>
	</action-attrs>

	<action-attrs name="action-invoice-attrs-printing-fields" if-module="axelor-business-project">
		<attribute name="hidden" for="displayTimesheetOnPrinting" if="__config__.app.isApp('business-project')"
			expr="eval: __repo__(InvoicingProject).all().filter('self.invoice.id = :id').bind('id',id).fetch().isEmpty() &amp;&amp; !__user__.activeCompany?.accountConfig?.displayTimesheetOnPrinting"/>
		<attribute name="value" for="displayTimesheetOnPrinting" if="__config__.app.isApp('business-project') &amp;&amp; __repo__(InvoicingProject).all().filter('self.invoice.id = :id').bind('id',id).fetch().isEmpty() &amp;&amp; !__user__.activeCompany?.accountConfig?.displayTimesheetOnPrinting"
			expr="eval: false"/>
		<attribute name="hidden" for="displayExpenseOnPrinting" if="__config__.app.isApp('business-project')"
			expr="eval: __repo__(InvoicingProject).all().filter('self.invoice.id = :id').bind('id',id).fetch().isEmpty() &amp;&amp; !__user__.activeCompany?.accountConfig?.displayExpenseOnPrinting"/>
		<attribute name="value" for="displayExpenseOnPrinting" if="__config__.app.isApp('business-project') &amp;&amp; __repo__(InvoicingProject).all().filter('self.invoice.id = :id').bind('id',id).fetch().isEmpty() &amp;&amp; !__user__.activeCompany?.accountConfig?.displayExpenseOnPrinting"
			expr="eval: false"/>
	</action-attrs>

	<action-attrs name="action-invoice-attrs-hidden-bank-details">
		<attribute for="companyBankDetails" name="hidden" expr="eval: !__config__.app.getApp('base').getManageMultiBanks()"/>
	</action-attrs>

	<action-attrs name="action-invoice-attrs-interco-supplychain" if-module="axelor-supplychain">
		<attribute for="interco" name="hidden"
				   expr="eval: createdByInterco || !partner || __repo__(Company).all().filter('self.partner = ?', partner).fetchOne() == null"/>
	   <attribute for="interco" name="readonly" expr="eval: true"
				   if="eval: statusSelect &gt; 2"/>
	</action-attrs>

    <action-attrs name="action-invoice-attrs-show-validate-button">
        <attribute name="hidden" expr="eval: (statusSelect != null &amp;&amp; statusSelect != 1) || __config__.app.getApp('invoice').getIsVentilationSkipped()" for="validateBtn"/>
        <attribute name="hidden" expr="eval: (statusSelect != null &amp;&amp; statusSelect != 1) || !__config__.app.getApp('invoice').getIsVentilationSkipped()" for="validateAndVentilateBtn"/>
    </action-attrs>

	<action-attrs name="action-invoice-attrs-change-create-refund-title">
		<attribute name="title" for="createRefundBtn" expr="eval: com.axelor.i18n.I18n.get('Generate invoice')" if="operationTypeSelect == __repo__(Invoice).OPERATION_TYPE_CLIENT_REFUND || operationTypeSelect == __repo__(Invoice).OPERATION_TYPE_SUPPLIER_REFUND"/>
	</action-attrs>
  
    <action-attrs name="action-account-invoice-atts-suppier-invoice-nbr">
      <attribute name="hidden" for="$duplicateInvoiceNbr" 
      expr="eval: !((supplierInvoiceNb != null &amp;&amp; id != null &amp;&amp; __repo__(Invoice).all().filter('self.supplierInvoiceNb = ? AND self.id != ?', supplierInvoiceNb , id).count() > 0)
                 || (supplierInvoiceNb != null &amp;&amp; id == null &amp;&amp; __repo__(Invoice).all().filter('self.supplierInvoiceNb = ?', supplierInvoiceNb).count() > 0))"/>
    </action-attrs>

    <action-attrs name="action-attrs-invoice-other-reason">
		<attribute for="reasonOfRefusalToPayStr" name="hidden" expr="reasonOfRefusalToPay.freeText == false"/>
	</action-attrs>

	<action-attrs name="action-invoice-attrs-is-valid-pfp-validator-user">
		<attribute name="value" for="$isValidPfpValidatorUser" expr="eval: __user__.isSuperPfpUser || __user__ == pfpValidatorUser"/>
	</action-attrs>

    <action-attrs name="action-invoice-reports-wizard-attrs-set-format-select">
    	<attribute name="readonly" for="$format" expr="eval: true" if="reportType != null &amp;&amp; reportType != 1"/>
    	<attribute name="readonly" for="$format" expr="eval: false" if="reportType != null &amp;&amp; reportType == 1"/>
    	<attribute name="value" for="$format" expr="eval: 'pdf'" if="reportType != null &amp;&amp; reportType != 1"/>
    	<attribute name="readonly" for="$format" expr="eval: false" if="reportType == null"/>
    	<attribute name="value" for="$format" expr="eval: null" if="reportType == null"/>
    </action-attrs>

    <action-attrs name="action-invoice-reports-wizard-attrs-set-report-type-select">
    	<attribute name="value" for="$reportType" expr="eval: 1" if="_statusSelect == 1 || (_statusSelect == 2 &amp;&amp; _operationSubTypeSelect != 2)"/>
    	<attribute name="value" for="$format" expr="pdf" if = "_statusSelect == 3"/>
    	<attribute name="readonly" for="$format" expr="eval: _statusSelect == 3"/>
    	<attribute name="value" expr="eval: _language" for="$language" />
    </action-attrs>

	<!-- DOMAIN -->

	<action-attrs name="action-invoice-partner-account-domain">
		<attribute name="domain" for="partnerAccount" expr="eval: &quot;self.company.id = ${company.id} AND (self.accountType.technicalTypeSelect = 'receivable' OR self.accountType.technicalTypeSelect = 'payable') AND self.useForPartnerBalance = true &quot;" if="company"/>
	</action-attrs>

	<action-attrs name="action-invoice-attrs-domain-address">
		<attribute name="domain" for="address" expr="eval: &quot;self.id IN (${(partner?.partnerAddressList?.findAll{it.isInvoicingAddr}.collect{it.address.id}+[null]).join(',')})&quot;" />
    </action-attrs>

    <!-- ACTION VALIDATE -->

    <action-validate name="action-validate-invoice-check-selection">
		<error message="You have to choose at least one invoice" if="invoiceToMerge == null || invoiceToMerge.size() == 0"/>
	</action-validate>

	<action-validate name="action-validate-send-email-remove-access-for-client">
		<error message="Error - You are not authorized to perform this action" if="__user__.group.isClient"/>
    </action-validate>

    <action-validate name="action-validate-invoice-ckeck-invoice-line-tax-list">
    	<alert message="There is no taxes on this invoice. Do you want to proceed ?" if="invoiceLineTaxList == null || invoiceLineTaxList.isEmpty()"/>
    </action-validate>

	<!-- ACTION METHOD -->

	<action-method name="action-method-invoice-address-str" model="com.axelor.apps.account.db.Invoice">
		<call class="com.axelor.apps.account.web.InvoiceController" method="computeAddressStr"/>
	</action-method>

	<action-method name="action-invoice-method-payment-mode-condition">
		<call class="com.axelor.apps.account.web.InvoiceController" method="fillPaymentModeAndCondition"/>
	</action-method>

	<action-method name="action-invoice-method-fill-in-lines">
		<call class="com.axelor.apps.supplychain.web.InvoiceController" method="fillInLines"/>
	</action-method>

	<action-method name="action-invoice-method-mass-validation">
    	<call class="com.axelor.apps.account.web.InvoiceController" method="massValidation"/>
    </action-method>

    <action-method name="action-invoice-method-mass-ventilation">
    	<call class="com.axelor.apps.account.web.InvoiceController" method="massVentilation"/>
    </action-method>

    <action-method name="action-invoice-method-show-invoice">
        <call class="com.axelor.apps.account.web.InvoiceController" method="showInvoice"/>
    </action-method>

	<action-method name="action-invoice-method-regenerate-and-show-invoice">
		<call class="com.axelor.apps.account.web.InvoiceController" method="regenerateAndShowInvoice"/>
	</action-method>

	<action-validate name="action-invoice-validate-regenerate-invoice">
		<alert message="Regenerating the printed copy can lead to several conflicting copies to be distributed. Do you still want to regenerate the printed copy?"/>
	</action-validate>

	<action-condition name="action-invoice-refusal-to-pay-cancel-reason-check">
		<check error="A cancel reason must be selected" field="cancelReason" if="reasonOfRefusalToPay == null || reasonOfRefusalToPay == 0"/>
	</action-condition>

	<action-method name="action-invoice-method-validate">
		<call class="com.axelor.apps.account.web.InvoiceController" method="validate"/>
	</action-method>

	<action-method name="action-invoice-method-ventilate">
		<call class="com.axelor.apps.account.web.InvoiceController" method="ventilate"/>
	</action-method>

    <action-method name="action-invoice-method-validate-and-ventilate">
        <call class="com.axelor.apps.account.web.InvoiceController" method="validateAndVentilate"/>
    </action-method>

	<action-method name="action-invoice-method-cancel">
		<call class="com.axelor.apps.account.web.InvoiceController" method="cancel"/>
	</action-method>

	<action-method name="action-invoice-method-create-refund">
		<call class="com.axelor.apps.account.web.InvoiceController" method="createRefund"/>
	</action-method>
	
	<action-method name="action-invoice-method-add-subline">
		<call class="com.axelor.apps.supplychain.web.InvoiceController" method="addSubLines"/>
	</action-method>
	
	<action-method name="action-invoice-method-remove-subline">
		<call class="com.axelor.apps.supplychain.web.InvoiceController" method="removeSubLines"/>
	</action-method>

	<action-method name="action-invoice-method-compute">
        <call class="com.axelor.apps.account.web.InvoiceController" method="compute"/>
    </action-method>

	<action-method name="action-invoice-method-fill-company-bank-details">
		<call class="com.axelor.apps.account.web.InvoiceController" method="fillCompanyBankDetails"/>
	</action-method>

	<action-method name="action-invoice-method-merge-account">
		<call class="com.axelor.apps.account.web.InvoiceController" method="mergeInvoice"/>
	</action-method>

	<action-method name="action-invoice-method-merge-supplychain">
		<call class="com.axelor.apps.supplychain.web.InvoiceController" method="mergeInvoice"/>
	</action-method>

	<action-method name="action-invoice-method-merge-business-project">
		<call class="com.axelor.apps.businessproject.web.InvoiceController" method="mergeInvoice"/>
	</action-method>

	<action-method name="action-invoice-method-create-advance-payment-domain">
		<call class="com.axelor.apps.account.web.InvoiceController"
			  method="fillAdvancePaymentInvoiceSetDomain"/>
	</action-method>

	<action-method name="action-invoice-method-fill-advance-payment-set">
		<call class="com.axelor.apps.account.web.InvoiceController"
			  method="fillAdvancePaymentInvoiceSet"/>
	</action-method>

	<action-method name="action-invoice-method-set-default-mail">
		<call class="com.axelor.apps.account.web.InvoiceController"
			  method="setDefaultMail"/>
	</action-method>

	<action-record name="action-invoice-record-update-info-company" model="com.axelor.apps.account.db.Invoice">
		<field name="tradingName" expr="eval: null" if="__config__.app.getApp('base').enableTradingNamesManagement"/>
		<field name="printingSettings" expr="eval: company?.printingSettings"/>
	</action-record>

	<action-method name="action-invoice-method-filter-printing-settings">
		<call class="com.axelor.apps.account.web.InvoiceController" method="filterPrintingSettings"/>
	</action-method>

	<action-method name="action-invoice-method-printing-settings-default-values">
		<call class="com.axelor.apps.account.web.InvoiceController" method="fillDefaultPrintingSettings"/>
	</action-method>

	<action-method name="action-invoice-method-fill-price-list">
		<call class="com.axelor.apps.account.web.InvoiceController"
			  method="fillPriceList"/>
	</action-method>

	<action-method name="action-invoice-method-domain-priceList">
		<call class="com.axelor.apps.account.web.InvoiceController"
			  method="changePriceListDomain"/>
	</action-method>
	
	<action-method name="action-invoice-method-register-mass-payment-on-supplier-invoices">
		<call class="com.axelor.apps.account.web.InvoiceController"
			  method="massPaymentOnSupplierInvoices"/>
	</action-method>
	
	<action-method name="action-invoice-method-check-not-imputed-refunds">
		<call class="com.axelor.apps.account.web.InvoiceController" method="checkNotImputedRefunds"/>
    </action-method>

  	<action-method name="action-invoice-method-check-not-lettered-advance-payment-move-lines">
		<call class="com.axelor.apps.account.web.InvoiceController" method="checkNotLetteredAdvancePaymentMoveLines"/>
 	</action-method>

	<action-method name="action-invoice-method-check-partner-bank-details-list">
		<call class="com.axelor.apps.account.web.InvoiceController" method="checkPartnerBankDetailsList"/>
	</action-method>

	<action-method name="action-invoice-method-refusal-to-pay">
		<call class="com.axelor.apps.account.web.InvoiceController" method="refusalToPay"/>
	</action-method>

	<action-method name="action-invoice-method-set-pfp-validator-user">
		<call class="com.axelor.apps.account.web.InvoiceController" method="setPfpValidatorUser"/>
	</action-method>

	<action-method name="action-invoice-method-domain-pfp-validator-user-on-select">
		<call class="com.axelor.apps.account.web.InvoiceController" method="setPfpValidatorUserDomain"/>
	</action-method>

	<action-method name="action-invoice-method-hide-send-email-pfp-btn">
		<call class="com.axelor.apps.account.web.InvoiceController" method="hideSendEmailPfpBtn"/>
	</action-method>

    <action-view name="action-invoice-view-register-payment" title="Register a payment" model="com.axelor.apps.account.db.InvoicePayment">
    	<view type="form" name="invoice-payment-form"/>
    	<view-param name="popup" value="reload"/>
	  	<view-param name="show-toolbar" value="false"/>
	  	<view-param name="forceEdit" value="true" />
 	  	<view-param name="show-confirm" value="true"/>
	  	<context name="_invoice" expr="eval: __this__"/>
    </action-view>

    <action-view name="action-invoice-view-register-payment-voucher" title="Register a payment" model="com.axelor.apps.account.db.PaymentVoucher">
        <view type="form" name="payment-voucher-form"/>
        <view-param name="popup" value="reload"/>
        <view-param name="show-toolbar" value="false"/>
        <view-param name="forceEdit" value="true" />
        <view-param name="show-confirm" value="true"/>
        <context name="_invoice" expr="eval: __this__"/>
    </action-view>

    <action-view name="action-invoice-mergecustinvoices" title="Merge Cust. Invoices" model="com.axelor.apps.base.db.Wizard">
		<view type="form" name="customer-invoices-merge-form"/>
	</action-view>

	<action-view name="action-invoice-view-show-subrogation-release" title="Subrogation releases" model="com.axelor.apps.account.db.SubrogationRelease">	
		<view type="grid" name="subrogation-release-grid" />
		<view type="form" name="subrogation-release-form" />
	  	<domain>:_invoice MEMBER OF self.invoiceSet</domain>
  		<context name="_invoice" expr="eval: __self__"/>
	</action-view>

	<action-view name="action-invoice-view-reports-wizard" title="Reports" model="com.axelor.apps.base.db.Wizard">
		<view type="form" name="invoice-reports-wizard-form"/>
		<view-param name="popup" value="reload"/>
		<view-param name="popup-save" value="false"/>
		<view-param name="show-toolbar" value="false" />
		<view-param name="show-confirm" value="false" />
		<context name="_statusSelect" expr="eval: statusSelect"/>
		<context name="_operationSubTypeSelect" expr="eval: operationSubTypeSelect"/>
		<context name="_printedPDF" expr="eval: printedPDF"/>
		<context name="id" expr="eval: id"/>
		<context name="_language" expr="eval: language"/>
	</action-view>


	<action-view name="action-invoice-view-refusal-to-pay" title="Cancellation" model="com.axelor.apps.account.db.Invoice">
	  	<view type="form" name="invoice-refusal-to-pay-wizard-form"/>
	  	<view-param name="popup" value="reload"/>
	  	<view-param name="show-toolbar" value="false"/>
	  	<view-param name="show-confirm" value="false" />
  	  	<view-param name="popup-save" value="false"/>
	  	<view-param name="forceEdit" value="true" />
	  	<context name="_showRecord" expr="eval: __this__.id" />
        <context name="_xApplicationType" expr="eval: _model"/>
	</action-view>

	<search-filters name="customer-invoices-filters" model="com.axelor.apps.account.db.Invoice" title="Customer invoices filters">
	    <field name="address" hidden="true"/>
	    <field name="debitBlockingByUser" title="Debit blocking done by"/>
	    <field name="debtRecoveryBlockingByUser" title="Debt recovery blocking done by"/>
	    <field name="debitBlockingReason" title="Debit blocking reason"/>
	    <field name="debtRecoveryBlockingReason" title="Debt recovery blocking reason"/>
	    <field name="debitBlockingToDate" title="Debit blocking until"/>
	    <field name="debtRecoveryBlockingToDate" title="Debt recovery blocking until"/>
	    <field name="companyExTaxTotal" title="Total W.T. in company currency"/>
	    <field name="companyTaxTotal" title="Total tax in company currency"/>
	    <field name="companyInTaxTotal" title="Total A.T.I. in company currency"/>
		<filter title="Validated">
			<domain>self.statusSelect = 2</domain>
		</filter>
		<filter title="Ventilated">
			<domain>self.statusSelect = 3</domain>
		</filter>
		<filter title="Unpaid">
			<domain>self.companyInTaxTotalRemaining &gt; 0</domain>
		</filter>
		<filter title="Unpaid Due">
			<domain>CURRENT_DATE &gt; self.dueDate and self.companyInTaxTotalRemaining &gt; 0</domain>
		</filter>
		<filter title="With Payment Rejected">
			<domain>self.rejectMoveLine IS NOT NULL</domain>
		</filter>
		<filter title="B2B">
			<domain>self.partner.partnerTypeSelect = 1</domain>
		</filter>
		<filter title="B2C">
			<domain>self.partner.partnerTypeSelect = 2</domain>
		</filter>
	</search-filters>

	<search-filters name="customer-refunds-filters" model="com.axelor.apps.account.db.Invoice" title="Customer refunds filters">
	    <field name="address" hidden="true"/>
	    <field name="debitBlockingByUser" title="Debit blocking done by"/>
	    <field name="debtRecoveryBlockingByUser" title="Debt recovery blocking done by"/>
	    <field name="debitBlockingReason" title="Debit blocking reason"/>
	    <field name="debtRecoveryBlockingReason" title="Debt recovery blocking reason"/>
	    <field name="debitBlockingToDate" title="Debit blocking until"/>
	    <field name="debtRecoveryBlockingToDate" title="Debt recovery blocking until"/>
	    <field name="companyExTaxTotal" title="Total W.T. in company currency"/>
	    <field name="companyTaxTotal" title="Total tax in company currency"/>
	    <field name="companyInTaxTotal" title="Total A.T.I. in company currency"/>
		<filter title="Validated">
			<domain>self.statusSelect = 2</domain>
		</filter>
		<filter title="Ventilated">
			<domain>self.statusSelect = 3</domain>
		</filter>
		<filter title="Unpaid">
			<domain>self.companyInTaxTotalRemaining &gt; 0</domain>
		</filter>
		<filter title="Unpaid Due">
			<domain>CURRENT_DATE &gt; self.dueDate and self.companyInTaxTotalRemaining &gt; 0</domain>
		</filter>
	</search-filters>

	<search-filters name="supplier-invoices-filters" model="com.axelor.apps.account.db.Invoice" title="Supplier invoices filters">
	    <field name="address" hidden="true"/>
	    <field name="debitBlockingByUser" title="Debit blocking done by"/>
	    <field name="debtRecoveryBlockingByUser" title="Debt recovery blocking done by"/>
	    <field name="debitBlockingReason" title="Debit blocking reason"/>
	    <field name="debtRecoveryBlockingReason" title="Debt recovery blocking reason"/>
	    <field name="debitBlockingToDate" title="Debit blocking until"/>
	    <field name="debtRecoveryBlockingToDate" title="Debt recovery blocking until"/>
	    <field name="companyExTaxTotal" title="Total W.T. in company currency"/>
	    <field name="companyTaxTotal" title="Total tax in company currency"/>
	    <field name="companyInTaxTotal" title="Total A.T.I. in company currency"/>
		<filter title="Draft">
			<domain>self.statusSelect = 1</domain>
		</filter>
		<filter title="Validated">
			<domain>self.statusSelect = 2</domain>
		</filter>
		<filter title="Ventilated">
			<domain>self.statusSelect = 3</domain>
		</filter>
		<filter title="Unpaid">
			<domain>self.companyInTaxTotalRemaining &gt; 0</domain>
		</filter>
		<filter title="Unpaid Due">
			<domain>CURRENT_DATE &gt; self.dueDate and self.companyInTaxTotalRemaining &gt; 0</domain>
		</filter>
	</search-filters>

	<search-filters name="supplier-refunds-filters" model="com.axelor.apps.account.db.Invoice" title="Supplier refunds filters">
	    <field name="address" hidden="true"/>
	    <field name="debitBlockingByUser" title="Debit blocking done by"/>
	    <field name="debtRecoveryBlockingByUser" title="Debt recovery blocking done by"/>
	    <field name="debitBlockingReason" title="Debit blocking reason"/>
	    <field name="debtRecoveryBlockingReason" title="Debt recovery blocking reason"/>
	    <field name="debitBlockingToDate" title="Debit blocking until"/>
	    <field name="debtRecoveryBlockingToDate" title="Debt recovery blocking until"/>
	    <field name="companyExTaxTotal" title="Total W.T. in company currency"/>
	    <field name="companyTaxTotal" title="Total tax in company currency"/>
	    <field name="companyInTaxTotal" title="Total A.T.I. in company currency"/>
		<filter title="Draft">
			<domain>self.statusSelect = 1</domain>
		</filter>
		<filter title="Validated">
			<domain>self.statusSelect = 2</domain>
		</filter>
		<filter title="Ventilated">
			<domain>self.statusSelect = 3</domain>
		</filter>
		<filter title="Unpaid">
			<domain>self.companyInTaxTotalRemaining &gt; 0</domain>
		</filter>
		<filter title="Unpaid Due">
			<domain>CURRENT_DATE &gt; self.dueDate and self.companyInTaxTotalRemaining &gt; 0</domain>
		</filter>
	</search-filters>

</object-views>
