-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] product_print_category: Improve computation of product_variant_…
…id for inactive templates Signed-off-by: Carmen Bianca BAKKER <[email protected]>
- Loading branch information
1 parent
a00f0c6
commit 93ce600
Showing
3 changed files
with
46 additions
and
0 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
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_print_category | ||
from . import test_product_template |
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,21 @@ | ||
# SPDX-FileCopyrightText: 2024 Coop IT Easy SC | ||
# | ||
# SPDX-License-Identifier: AGPL-3.0-or-later | ||
|
||
from odoo.tests.common import SavepointCase | ||
|
||
|
||
class TestProductTemplate(SavepointCase): | ||
def test_product_variant_id(self): | ||
"""Test that product_variant_id is correctly populated for cloned | ||
archived products. | ||
""" | ||
product = self.env["product.template"].create({"name": "Test"}) | ||
breakpoint() | ||
product.active = False | ||
new_product = product.copy() | ||
new_variants = new_product.with_context(active_test=False).product_variant_ids | ||
self.assertFalse(new_product.active) | ||
self.assertEqual(new_product.product_variant_id, new_variants[0]) | ||
new_product.active = True | ||
self.assertEqual(new_product.product_variant_id, new_variants[0]) |