<?xml version="1.0" encoding="utf-8" ?>
<odoo>
    <record id="product_pricelist_item_form_view_inherit" model="ir.ui.view">
        <field name="name">product.pricelist.item.form.inherit.total.margin</field>
        <field name="model">product.pricelist.item</field>
        <field name="inherit_id" ref="product.product_pricelist_item_form_view" />
        <field name="arch" type="xml">
            <!-- Add use_total_margin and margin_type fields after compute_price -->
            <field name="compute_price" position="after">
                <field
                    name="use_total_margin"
                    invisible="compute_price != 'formula' or base != 'pricelist'"
                />
                <field
                    name="margin_type"
                    invisible="not use_total_margin"
                />
            </field>
        </field>
    </record>
</odoo>
