<?xml version="1.0" encoding="utf-8" ?>
<odoo>
    <record id="view_order_form" model="ir.ui.view">
        <field name="name">sale.order.form.inherit</field>
        <field name="model">sale.order</field>
        <field name="inherit_id" ref="sale.view_order_form" />
        <field name="arch" type="xml">
            <button name="action_draft" position="after">
                <button
                    name="action_create_rma"
                    type="object"
                    string="Create RMA"
                    states="sale,done"
                    groups="rma.rma_group_user_own"
                />
            </button>
            <div name="button_box">
                <button
                    name="action_view_rma"
                    type="object"
                    class="oe_stat_button"
                    icon="fa-reply"
                    attrs="{'invisible': [('rma_count', '=', 0)]}"
                    groups="rma.rma_group_user_own"
                >
                    <field name="rma_count" widget="statinfo" string="RMA" />
                </button>
            </div>
        </field>
    </record>
</odoo>
