[FIX] mrp: add persistent domain

Steps to reproduce the bug:

- Create a product template A with variant color: black and white.
- Create attribute : size : 16gb and 32 gb
- Create a bom with template A.
- Add a bom line L with product B
- Save the bom ,edit it and select an attribute value for L

Bug:

All attribute values of the database (color: white, color: black, size: 16 gb, size 32 gb)
were displayed.

opw:2006988

closes odoo/odoo#33949

Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
This commit is contained in:
Florent de Labarre
2019-06-06 12:03:19 +00:00
committed by Goffin Simon
parent 2e7cbca0e9
commit 808238212e
2 changed files with 3 additions and 1 deletions
+1
View File
@@ -230,6 +230,7 @@ class MrpBomLine(models.Model):
'mrp.bom', 'Parent BoM',
index=True, ondelete='cascade', required=True)
parent_product_tmpl_id = fields.Many2one('product.template', 'Parent Product Template', related='bom_id.product_tmpl_id')
valid_product_attribute_value_ids = fields.Many2many('product.attribute.value', related='bom_id.product_tmpl_id.valid_product_attribute_value_ids')
attribute_value_ids = fields.Many2many(
'product.attribute.value', string='Apply on Variants',
help="BOM Product Variants needed form apply this line.")
+2 -1
View File
@@ -66,8 +66,9 @@
<button name="action_see_attachments" type="object" icon="fa-file" attrs="{'invisible': [('has_attachments', '=', False)]}" aria-label="Attachments" title="Attachments"/>
<field name="product_qty"/>
<field name="parent_product_tmpl_id" invisible="1" />
<field name="valid_product_attribute_value_ids" invisible="1"/>
<field name="product_uom_id" options="{'no_open':True,'no_create':True}" groups="uom.group_uom"/>
<field name="attribute_value_ids" widget="many2many_tags" options="{'no_create': True}" attrs="{'column_invisible': [('parent.product_id', '!=', False)]}" groups="product.group_product_variant"/>
<field name="attribute_value_ids" widget="many2many_tags" domain="[('id', 'in', valid_product_attribute_value_ids)]" options="{'no_create': True}" attrs="{'column_invisible': [('parent.product_id', '!=', False)]}" groups="product.group_product_variant"/>
<field name="operation_id" groups="mrp.group_mrp_routings" domain="[('routing_id', '=', parent.routing_id)]" options="{'no_quick_create':True,'no_create_edit':True}"/>
</tree>
</field>