Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
3854 Vistas

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
Descartar
Mejor respuesta

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
Descartar

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

Autor

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?

Publicaciones relacionadas Respuestas Vistas Actividad
5
sept 23
48862
2
mar 24
5598
1
dic 21
9620
2
ene 16
4320
2
sept 15
4150