Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][FIX] product_variant_default_code ir.config_parameter #372

Open
wants to merge 1 commit into
base: 16.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading