Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
3849 Widoki

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

Awatar
Odrzuć
Najlepsza odpowiedź

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

Awatar
Odrzuć

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

Powiązane posty Odpowiedzi Widoki Czynność
5
wrz 23
48845
2
mar 24
5590
1
gru 21
9615
2
sty 16
4319
2
wrz 15
4147