[FIX] product: Variants settings on specific test

Some tests on dynamic variants mechanism didn't pass on test
without demo data due to odoo/odoo#143543.

closes odoo/odoo#159933

X-original-commit: 12fe7400d58ef12d78a54e3b12d04c28a9564982
Signed-off-by: Benjamin Hanquin (beha) <beha@odoo.com>
This commit is contained in:
Benjamin Hanquin (beha)
2024-04-02 07:20:24 +00:00
parent 1e69238331
commit 0d79f974f7
2 changed files with 4 additions and 0 deletions
+2
View File
@@ -31,6 +31,8 @@ class TestName(TransactionCase):
self.assertNotIn(self.product.id, res_ids)
def test_product_template_search_name_no_product_product(self):
# To be able to test dynamic variant "variants" feature must be set up
self.env.user.write({'groups_id': [(4, self.env.ref('product.group_product_variant').id)]})
color_attr = self.env['product.attribute'].create({'name': 'Color', 'create_variant': 'dynamic'})
color_attr_value_r = self.env['product.attribute.value'].create({'name': 'Red', 'attribute_id': color_attr.id})
color_attr_value_b = self.env['product.attribute.value'].create({'name': 'Blue', 'attribute_id': color_attr.id})
+2
View File
@@ -1026,6 +1026,8 @@ class TestVariantsArchive(ProductVariantsCommon):
self.assertEqual(archived_variants, variants_2x0)
def test_name_search_dynamic_attributes(self):
# To be able to test dynamic variant "variants" feature must be set up
self.env.user.write({'groups_id': [(4, self.env.ref('product.group_product_variant').id)]})
dynamic_attr = self.env['product.attribute'].create({
'name': 'Dynamic',
'create_variant': 'dynamic',