Remove field from Product Template tree view

Hi,

I want to remove the products field from the template_view_tree by inheriting the view with:

<record model="ir.ui.view" id="template_view_tree">
    <field name="model">product.template</field>
    <field name="inherit" ref="product.template_view_tree"/>
    <field name="name">template_tree</field>
</record>

and the view:

<?xml version="1.0"?>
<data>
    <xpath expr="//field[@name='products']" position="replace" />
</data>

now for the template view this works, but when I open the variants view I get:
No elements found for expression "//field[@name='products']"
I guess because the original variant view already inherits from the template view and removes itself the field and then it can not be removed again.
How could I solve this in my custom module? Can I somehow change the order such that first the variant view uses the original template view and only afterwards my change is applied?

Kind regards

I think you have no other options than define a complete new view and use it instead of the standard one in every action (create a new action view and deactivate the existing one).

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

You can make it work by making the field invisible instead of replacing it:

<xpath expr="//field[@name='products']" position="replace_attributes"> <field name="products" invisible="1"/> </xpath>

This way you just hide it from the template view while you allow the product form to remove it.

Another option is to remove it for the current place and add it in another part as invisible.