<?xml version="1.0" encoding="UTF-8"?>
<openerp>
    <data>
        <record id="view_invoice_customer" model="ir.ui.view">
            <field name="name">account.invoice.customer.pay</field>
            <field name="model">account.invoice</field>
            <field name="inherit_id" ref="account.invoice_form"/>
            <field name="arch" type="xml">
                <xpath expr="//button[@name='invoice_open'][last()]" position="after">
                    <button name="invoice_pay_customer" type="object" string="Register Payment"
                        attrs="{'invisible': ['|', ('state','!=','open'), ('sent','=',True)]}" groups="base.group_user"/>
                    <button name="invoice_pay_customer" type="object" string="Register Payment"
                        attrs="{'invisible': ['|', ('state','!=','open'), ('sent','=',False)]}" class="oe_highlight" groups="base.group_user"/>
                </xpath>
            </field>
        </record>
        <record id="view_invoice_supplier" model="ir.ui.view">
            <field name="name">account.invoice.supplier.pay</field>
            <field name="model">account.invoice</field>
            <field name="inherit_id" ref="account.invoice_supplier_form"/>
            <field name="arch" type="xml">
                <xpath expr="//button[@name='invoice_open'][last()]" position="after">
                    <button name="invoice_pay_customer" type="object" string="Pay" states="open" class="oe_highlight" groups="base.group_user"/>
                </xpath>
            </field>
        </record>
    </data>
</openerp>
