<?xml version="1.0" encoding="utf-8"?>
<!--
  Copyright 2019-2024 Akretion France (http://www.akretion.com/)
  @author: Alexis de Lattre <alexis.delattre@akretion.com>
  License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->

<odoo>


<record id="view_order_form" model="ir.ui.view">
    <field name="name">advance_payment.sale.order.form</field>
    <field name="model">sale.order</field>
    <field name="inherit_id" ref="sale.view_order_form"/>
    <field name="arch" type="xml">
        <notebook position="inside">
            <page name="advance_payment" string="Advance Payments">
                <field name="payment_ids" nolabel="1" colspan="2"/>
                <field name="amount_residual" invisible="1"/>
            </page>
        </notebook>
        <field name="amount_total" position="after">
            <div class="oe_subtotal_footer_separator oe_inline o_td_label">
                <label for="amount_down_payment" />
            </div>
            <field name="amount_down_payment" nolabel="1" class="oe_subtotal_footer_separator"/>
        </field>
        <button name="action_cancel" position="before">
            <button type="action" name="%(sale_down_payment.account_payment_register_sale_action)d" string="Register Payment" attrs="{'invisible': ['|', ('amount_residual', '&lt;=', 0), ('invoice_status', '=', 'invoiced')]}"/>
        </button>
    </field>
</record>


</odoo>
