<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
    <record id="account_invoice_change_form" model="ir.ui.view">
        <field name="name">Invoice Change</field>
        <field name="model">account.invoice.change</field>
        <field name="arch" type="xml">
            <form string="Invoice Change">
                <group>
                    <group name="group_left">
                        <field name="invoice_id" invisible="1"/>
                        <field name="invoice_company_id" invisible="1"/>
                        <field name="user_id"/>
                        <field name="date"/>
                    </group>
                    <group name="group_right"/>
                </group>
                <footer>
                    <button name="affect_change" string="Change" type="object" class="btn-primary"/>
                    <button string="Cancel" class="btn-default" special="cancel"/>
                </footer>
            </form>
        </field>
    </record>

    <record id="action_view_account_invoice_change" model="ir.actions.act_window">
        <field name="name">Invoice Change Wizard</field>
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">account.invoice.change</field>
        <field name="view_type">form</field>
        <field name="view_mode">form</field>
        <field name="target">new</field>
    </record>

    <record id="invoice_form_inherit" model="ir.ui.view">
        <field name="name">account.invoice.form.inherit</field>
        <field name="model">account.invoice</field>
        <field name="inherit_id" ref="account.invoice_form"/>
        <field name="arch" type="xml">
            <xpath expr="//field[@name='state']" position="before">
                <button name="%(action_view_account_invoice_change)d" string="Change"
                        type="action" class="btn-secondary"
                        attrs="{'invisible': [('state', 'in', ('sale', 'done', 'cancel'))]}"
                        context="{'default_invoice_id': id}"
                        groups="account.group_account_manager" />
            </xpath>
       </field>
    </record>
</odoo>