Skip to Content
Menu
This question has been flagged
1 Reply
3300 Views

The view "product.supplierinfo.form.view" has the field product_id that is only visible for the group "product.group_product_variant". 

I'm updating an OCA module that inherits this view. How can I add an additional group to the list of groups that can see the product_id field? (the new group is product.group_stock_packaging)

For better future extensibility by others, I want to append to the list of groups as opposed to overwriting the group(s).

Avatar
Discard
Best Answer

Hi,

You can inherit the corresponding view and modify the group attribute as follows:

<record model="ir.ui.view" id="product_supplierinfo_form_view">
<field name="name">product.supplierinfofield>
<field name="model">product.supplierinfofield>
<field name="inherit_id" ref="product.product_supplierinfo_form_view"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='product_id']" position="attributes">
<attribute name="groups">product.group_product_variant,product.group_stock_packagingattribute>
xpath>
field>
record>


Thanks

Avatar
Discard

<record model="ir.ui.view" id="product_supplierinfo_form_view">
<field name="name">product.supplierinfo</field>
<field name="model">product.supplierinfo</field>
<field name="inherit_id" ref="product.product_supplierinfo_form_view"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='product_id']" position="attributes">
<attribute name="groups">product.group_product_variant,product.group_stock_packaging</attribute>
</xpath>
</field>
</record>

Author

Hi Niyas — thank you for your response! But that doesn't that just overwrite whatever groups are already set for that field? I'd like to add to whatever groups are currently there (for better extensibility). In Odoo addons, I feel like we do a lot of overwriting when maybe adding to what other people have currently extended would be better?

Related Posts Replies Views Activity
5
Sep 23
47866
2
Mar 24
5064
1
Dec 21
8941
2
Jan 16
3891
2
Sep 15
3696