<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
    <record id="view_order_form_inherit" 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">
            <xpath expr="//div[@name='button_box']" position="inside">
                <button name="%(rma.action_rma_rma)d" type="action" class="oe_stat_button" icon="fa-cubes"
                        attrs="{'invisible': [('rma_count', '=', 0), ('state', 'not in', ('sale', 'done', 'cancel'))]}"
                        context="{'search_default_sale_order_id': active_id, 'default_sale_order_id': active_id}">
                    <div class="o_field_widget o_stat_info">
                        <span class="o_stat_value"><field name="rma_count"/></span> RMA
                    </div>
                </button>
            </xpath>
        </field>
    </record>
</odoo>