From 4b8d716188b6a252602170ed2db3a172a6370e75 Mon Sep 17 00:00:00 2001 From: Jorge Pinna Puissant Date: Mon, 29 Jun 2020 08:52:48 +0000 Subject: [PATCH] [FIX] website_sale: avoid archiving loyalty program products A product can't be archived if it's used in a pos loyalty program. opw-2276745 closes odoo/odoo#53948 X-original-commit: 3af9b65638a9725fbeb6597b77328d8f6be5b2ec Related: odoo/enterprise#11590 Signed-off-by: Jorge Pinna Puissant (jpp) --- addons/website_sale/tests/test_website_sequence.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/addons/website_sale/tests/test_website_sequence.py b/addons/website_sale/tests/test_website_sequence.py index 85cb3cc409f..b09193b3d7c 100644 --- a/addons/website_sale/tests/test_website_sequence.py +++ b/addons/website_sale/tests/test_website_sequence.py @@ -14,6 +14,13 @@ class TestWebsiteSequence(odoo.tests.TransactionCase): # if stock is installed we can't archive since there is orderpoints if hasattr(self.env['product.product'], 'orderpoint_ids'): product_templates.mapped('product_variant_ids.orderpoint_ids').write({'active': False}) + # if pos loyalty is installed we can't archive since there are loyalty rules and rewards + if 'loyalty.rule' in self.env: + rules = self.env['loyalty.rule'].search([]) + rules.unlink() + if 'loyalty.reward' in self.env: + rewards = self.env['loyalty.reward'].search([]) + rewards.unlink() product_templates.write({'active': False}) self.p1, self.p2, self.p3, self.p4 = ProductTemplate.create([{ 'name': 'First Product',