[FIX] product: fix template tag creation in variant view

Before this fix, the ORM tried to fetch the `product.template` using the `product.product`'s id when creating a new product tag. This was caused by the `context="{'product_template_id': id}"` attribute on the `product_tag_ids` field in `product_template_form_view` [1]. However, `product_normal_form_view` inherits `product_template_form_view` [2], so `context="{'product_template_id': id}"` ended up assigning a `product.product` id to `product_template_id`.

The fix overrides the context attribute in `product_normal_form_view`.

[1] https://github.com/odoo/odoo/blob/06c4d0363e56a640b2239a17ff32e6681ba78018/addons/product/views/product_views.xml#L85
[2] https://github.com/odoo/odoo/blob/06c4d0363e56a640b2239a17ff32e6681ba78018/addons/product/views/product_views.xml#L387

task-3619625

closes odoo/odoo#152739

X-original-commit: 44738fb2306bc18f6eee6412a62689f45bc5f009
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
This commit is contained in:
Louis (loti)
2024-02-06 18:49:08 +00:00
parent 8f1ff11909
commit b6eaf4964a
+1
View File
@@ -425,6 +425,7 @@
</xpath>
<field name="product_tag_ids" position="attributes">
<attribute name="options">{'no_open': True}</attribute>
<attribute name="context">{'product_template_id': product_tmpl_id}</attribute>
</field>
<field name="product_tag_ids" position="after">
<field name="additional_product_tag_ids" widget="many2many_tags"/>