-
-
Notifications
You must be signed in to change notification settings - Fork 269
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIG] product_variant_specific_description: Migration to 18.0
- Loading branch information
1 parent
7870274
commit eb9af2a
Showing
8 changed files
with
69 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,6 +58,7 @@ Contributors | |
------------ | ||
|
||
- Lois Rilo <[email protected]> | ||
- [Heliconia Solutions Pvt. Ltd.](https://www.heliconia.io) | ||
|
||
Maintainers | ||
----------- | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
- Lois Rilo \<<[email protected]>\> | ||
- \[Heliconia Solutions Pvt. Ltd.\](<https://www.heliconia.io>) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
from . import test_product_variant_description | ||
from . import test_product_template |
59 changes: 59 additions & 0 deletions
59
product_variant_specific_description/tests/test_product_template.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
from odoo.tests import TransactionCase | ||
|
||
|
||
class TestProductTemplate(TransactionCase): | ||
def test_is_system_multi_lang(self): | ||
""" | ||
Test case to check if the is_system_multi_lang field is | ||
set correctly based on the system's language count. | ||
""" | ||
product_template = self.env["product.template"].create( | ||
{ | ||
"name": "Test Product", | ||
} | ||
) | ||
|
||
lang_count = self.env["res.lang"].search_count([]) | ||
|
||
# Ensure only one language exists, unlink others | ||
if lang_count > 1: | ||
langs = self.env["res.lang"].search([("code", "!=", "en_US")]) | ||
langs.unlink() | ||
|
||
product_template._compute_is_system_multi_lang() | ||
|
||
# Check if the computed value is correct based on language count | ||
if lang_count == 1: | ||
self.assertFalse( | ||
product_template.is_system_multi_lang, | ||
"The is_system_multi_lang field should be False " | ||
"when only one language exists.", | ||
) | ||
else: | ||
self.assertTrue( | ||
product_template.is_system_multi_lang, | ||
"The is_system_multi_lang field should be True " | ||
"when multiple languages exist.", | ||
) | ||
|
||
def test_prepare_variant_values(self): | ||
""" | ||
Test case to check if the description is included when preparing variant values. | ||
""" | ||
product_template = self.env["product.template"].create( | ||
{ | ||
"name": "Test Product", | ||
"description": "Product template description", | ||
} | ||
) | ||
|
||
# Using correct model | ||
combination = self.env["product.attribute.value"].browse([]) | ||
|
||
variant_values = product_template._prepare_variant_values(combination) | ||
|
||
self.assertEqual( | ||
variant_values.get("description"), | ||
product_template.description, | ||
"The description should be included in the prepared variant values.", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters