<odoo>
    <record model="ir.ui.view" id="view_sale_order_form_inherit_button_advance">
        <field name="name">view.sale.order.form.inherit.button.advance</field>
        <field name="model">sale.order</field>
        <field name="inherit_id" ref="sale.view_order_form"/>
        <field name="arch" type="xml">
            <xpath expr='//header' position="inside">
                <button name="button_advance" string="Авансовый счет" type="object" invisible="state != 'sale'"/>
            </xpath>
            <div name="button_box" position="inside">
                <button class="oe_stat_button" type="object" name="action_prepaid_advance"
                        icon="fa-suitcase" invisible="prepaid_advance_count == 0">
                    <field string="Авансовые счета" name="prepaid_advance_count" widget="statinfo"/>
                </button>
            </div>
        </field>
    </record>
</odoo>