[FIX] mrp: domain on variant

Make sure there is a product set before searching the attributes, otherwise
it crashes.
This commit is contained in:
Nicolas Martinelli
2019-02-26 14:34:16 +00:00
parent 05533ceda6
commit 489222e373
+2
View File
@@ -290,6 +290,8 @@ class MrpBomLine(models.Model):
@api.onchange('parent_product_tmpl_id')
def onchange_parent_product(self):
if not self.parent_product_tmpl_id:
return {}
return {'domain': {'attribute_value_ids': [
('id', 'in', self.parent_product_tmpl_id._get_valid_product_attribute_values().ids),
('attribute_id.create_variant', '!=', 'no_variant')