Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odgovori
3839 Prikazi

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
Opusti
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
Opusti

<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>

Avtor

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 Odgovori Prikazi Aktivnost
5
sep. 23
48820
2
mar. 24
5576
1
dec. 21
9606
2
jan. 16
4315
2
sep. 15
4145