Skip to content

Commit

Permalink
[FIX][product_variant_default_code] check code of active value_ids
Browse files Browse the repository at this point in the history
  • Loading branch information
Kev-Roche authored and Raul-S73 committed Apr 25, 2023
1 parent 5fa4d31 commit 20320aa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion product_variant_default_code/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"license": "AGPL-3",
"category": "Product",
"maintainers": ["Kev-Roche"],
"depends": ["product"],
"depends": ["product", "product_attribute_archive"],
"data": [
"security/product_security.xml",
"data/ir_config_parameter.xml",
Expand Down
6 changes: 5 additions & 1 deletion product_variant_default_code/models/product.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,11 @@ def _inverse_default_code(self):
rec.manual_code = bool(rec.default_code)

def _generate_default_code(self):
value_codes = self.product_tmpl_id.attribute_line_ids.value_ids.mapped("code")
value_codes = [
rec.code
for rec in self.product_tmpl_id.attribute_line_ids.value_ids
if rec.active
]
if (not self.code_prefix and self.product_tmpl_id.is_automask()) or not all(
value_codes
):
Expand Down

0 comments on commit 20320aa

Please sign in to comment.