Skip to content
Permalink
Browse files

[FIX] product: Issues with product configurator with single attribute…

… values

When creating several attribute lines for the same attribute, the function _update_product_template_attribute_values
in model 'product.template.attribute.line' only kept the product.template.attribute.value records of the last
created line. So it generated issues with the product configurator because no value was founded for certain attribute line
in function _get_possible_combinations defined in model 'product.template'.

Now it's forbidden to create several attribute lines for the same attribute.

opw:1950786
  • Loading branch information...
simongoffin committed Mar 25, 2019
1 parent b8950ab commit ce00fcb451439d3adb75b94fcc3001b6dccd8f3e
Showing with 12 additions and 0 deletions.
  1. +6 −0 addons/product/i18n/product.pot
  2. +6 −0 addons/product/models/product_template.py
@@ -2424,6 +2424,12 @@ msgstr ""
msgid "You cannot define the decimal precision of 'Account' as greater than the rounding factor of the company's main currency"
msgstr ""

#. module: product
#: code:addons/product/models/product_template.py:332
#, python-format
msgid "You cannot define two attribute lines for the same attribute."
msgstr ""

#. module: product
#: code:addons/product/models/product_attribute.py:79
#, python-format
@@ -326,6 +326,12 @@ def _check_uom(self):
raise ValidationError(_('The default Unit of Measure and the purchase Unit of Measure must be in the same category.'))
return True

@api.constrains('attribute_line_ids')
def _check_attribute_line(self):
if any(len(template.attribute_line_ids) != len(template.attribute_line_ids.mapped('attribute_id')) for template in self):
raise ValidationError(_('You cannot define two attribute lines for the same attribute.'))
return True

@api.onchange('uom_id')
def _onchange_uom_id(self):
if self.uom_id:

0 comments on commit ce00fcb

Please sign in to comment.
You can’t perform that action at this time.