<?xml version="1.0" encoding="UTF-8"?>
<odoo>
    <record id="product_template_only_form_view_bomlines" model="ir.ui.view">
        <field name="model">product.template</field>
        <field name="inherit_id" ref="product.product_template_only_form_view"/>
        <field name="arch" type="xml">
            <xpath expr="//page[@name='sales']" position="after">
                <page name="bom_line" string="Bill of Materials">
                    <div attrs="{'invisible': [('bom_count', '&lt;', 2)]}"
                         class="alert alert-danger text-center"
                         role="alert">
                        <p>The product is linked to several BoMs, modifications must be done BoM-side.</p>
                    </div>
                    <div attrs="{'invisible': [('bom_count', '!=', 0)]}"
                         class="alert alert-danger text-center"
                         role="alert">
                        <p>The product doesn't have a BoM yet, you must create one before updating its components.</p>
                        <button name="button_create_bom" type="object" string="Create BoM"/>
                    </div>
                    <field name="specific_bom_line_ids" attrs="{'invisible': [('bom_count', '!=', 1)]}">
                        <tree editable="bottom">
                            <field name="product_id"/>
                            <field name="product_qty"/>
                            <field name="attribute_value_ids" widget="many2many_tags"/>
                        </tree>
                    </field>
                </page>
            </xpath>
        </field>
    </record>
</odoo>
