Skip to content

Commit

Permalink
[FIX] product_variant_default_code ir.config_parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
giarve authored and astirpe committed Dec 6, 2024
1 parent 2961af9 commit 71cc5c3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion product_variant_default_code/models/product.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,9 @@ def _guess_main_lang(self):
)
def _compute_default_code(self):
super()._compute_default_code()
if self.env["ir.config_parameter"].get_param("prefix_as_default_code"):
if self.env["ir.config_parameter"].get_param(
"product_variant_default_code.prefix_as_default_code"
):
unique_variants = self.filtered(
lambda template: len(template.product_variant_ids) == 1
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,9 @@ def test_10_code_change_propagation_archived_variant(self):

def test_11_prefix_code_as_default_code_by_default(self):
self.assertFalse(self.template1.default_code)
self.env["ir.config_parameter"].set_param("prefix_as_default_code", True)
self.env["ir.config_parameter"].set_param(
"product_variant_default_code.prefix_as_default_code", True
)
self.template1.code_prefix = "prefix_code"
self.assertTrue(self.template1.default_code, self.template1.code_prefix)

Expand Down

0 comments on commit 71cc5c3

Please sign in to comment.