<?xml version="1.0" encoding="utf-8" ?>
<odoo>
    <record id="mrp_production_form_view" model="ir.ui.view">
        <field name="name">mrp.production.form - Add attachments smart-button</field>
        <field name="model">mrp.production</field>
        <field name="inherit_id" ref="mrp.mrp_production_form_view" />
        <field name="arch" type="xml">
            <xpath expr="///button[@name='action_see_move_scrap']" position="after">
                <button
                    class="oe_stat_button"
                    name="action_show_attachments"
                    type="object"
                    icon="fa-files-o"
                >
                    <div class="o_field_widget o_stat_info">
                        <span class="o_stat_text">Product<br />Attachments</span>
                    </div>
                </button>
                <button
                    class="oe_stat_button"
                    name="action_show_bom_attachments"
                    type="object"
                    icon="fa-files-o"
                >
                    <div class="o_field_widget o_stat_info">
                        <span class="o_stat_text">BoM<br />Attachments</span>
                    </div>
                </button>
            </xpath>
        </field>
    </record>
    <record id="action_show_production_attachments" model="ir.actions.server">
        <field name="name">Product Attachments</field>
        <field name="model_id" ref="mrp.model_mrp_production" />
        <field name="binding_model_id" ref="mrp.model_mrp_production" />
        <field name="binding_view_types">list</field>
        <field name="state">code</field>
        <field name="code">
            if records:
                action = records.action_show_attachments()
        </field>
    </record>
     <record id="action_show_production_bom_attachments" model="ir.actions.server">
        <field name="name">BoM Attachments</field>
        <field name="model_id" ref="mrp.model_mrp_production" />
        <field name="binding_model_id" ref="mrp.model_mrp_production" />
        <field name="binding_view_types">list</field>
        <field name="state">code</field>
        <field name="code">
            if records:
                action = records.action_show_bom_attachments()
        </field>
    </record>
</odoo>
