<?xml version="1.0"?>
<data><xpath expr="//form" position="attributes">
                <attribute name="name">Product Template</attribute>
            </xpath>
            <field name="categ_id" position="after">
                <field name="default_code" attrs="{'invisible': [('product_variant_count', '&gt;', 1)]}"/>
                <field name="barcode" attrs="{'invisible': [('product_variant_count', '&gt;', 1)]}"/>
            </field>

            <div name="button_box" position="inside">
                <button name="160" type="action" icon="fa-sitemap" class="oe_stat_button" attrs="{'invisible': [('product_variant_count', '&lt;=', 1)]}" groups="product.group_product_variant">
                    <field string="Variants" name="product_variant_count" widget="statinfo"/>
                </button>
            </div>

            <xpath expr="//page[@name='general_information']" position="after">
                <page name="variants" string="Attributes &amp; Variants" groups="product.group_product_variant">
                    <field name="attribute_line_ids" widget="one2many" context="{'show_attribute': False}">
                        <tree string="Variants" editable="bottom" decoration-info="value_count &lt;= 1">
                            <field name="value_count" invisible="1"/>
                            <field name="attribute_id" attrs="{'readonly': [('id', '!=', False)]}"/>
                            <field name="value_ids" widget="many2many_tags" options="{'no_create_edit': True, 'color_field': 'color'}" context="{'default_attribute_id': attribute_id, 'show_attribute': False}"/>
                            <button string="Configure" class="float-end btn-secondary" type="object" name="action_open_attribute_values" groups="product.group_product_variant"/>
                        </tree>
                    </field>
                        <p class="oe_grey oe_edit_only">
                        <strong>Warning</strong>: adding or deleting attributes
                        will delete and recreate existing variants and lead
                        to the loss of their possible customizations.
                    </p>
                </page>
            </xpath>
        </data>