Se rendre au contenu
Menu
Cette question a été signalée
1 Répondre
3838 Vues

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
Ignorer
Meilleure réponse

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
Ignorer

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

Auteur

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?

Publications associées Réponses Vues Activité
5
sept. 23
48820
2
mars 24
5575
1
déc. 21
9604
2
janv. 16
4315
2
sept. 15
4145