<?xml version="1.0" encoding="utf-8" ?>
<odoo>
    <record id="account_payment_order_form" model="ir.ui.view">
        <field name="name">account.payment.order.form</field>
        <field name="model">account.payment.order</field>
        <field
            name="inherit_id"
            ref="account_payment_order.account_payment_order_form"
        />
        <field name="arch" type="xml">
            <div name="button_box">
                <button
                    name="action_view_notifications"
                    type="object"
                    class="oe_stat_button"
                    icon="fa-envelope"
                    attrs="{'invisible': [('notification_count', '=', 0)]}"
                >
                    <field
                        name="notification_count"
                        widget="statinfo"
                        string="Notifications"
                    />
                </button>
            </div>
            <button name="action_cancel" position="before">
                <button
                    type="action"
                    name="%(wizard_account_payment_order_notification_action)d"
                    string="Send mails"
                    attrs="{'invisible': ['|', ('state', 'not in', ('uploaded','done')), ('notification_count', '>', 0)]}"
                />
            </button>
        </field>
    </record>
</odoo>
