From 6ef8586f7d6e14d8ead95e6ccc1089d6d0138933 Mon Sep 17 00:00:00 2001 From: pilarvargas-tecnativa Date: Mon, 15 Jul 2024 13:51:44 +0200 Subject: [PATCH] [FIX] loyalty_criteria_multi_product: Complete loyalty_rule table data The loyalty_criteria field data, previously in the loyalty_program table (coupon_program) must be moved completely, both the value 'multi_product' and 'domain' to the loyalty_rule table where this data must now be stored. Otherwise the data 'domain' will be lost. TT44317 --- .../migrations/16.0.1.0.0/pre-migration.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/loyalty_criteria_multi_product/migrations/16.0.1.0.0/pre-migration.py b/loyalty_criteria_multi_product/migrations/16.0.1.0.0/pre-migration.py index 6efc6d15..30ab38d6 100644 --- a/loyalty_criteria_multi_product/migrations/16.0.1.0.0/pre-migration.py +++ b/loyalty_criteria_multi_product/migrations/16.0.1.0.0/pre-migration.py @@ -19,10 +19,13 @@ def move_coupon_criteria_to_rule(env): env.cr, """ UPDATE loyalty_rule AS lr - SET loyalty_criteria = 'multi_product' + SET loyalty_criteria = CASE + WHEN lp.coupon_criteria = 'multi_product' THEN 'multi_product' + WHEN lp.coupon_criteria = 'domain' THEN 'domain' + END FROM loyalty_program AS lp WHERE lr.program_id = lp.id - AND lp.coupon_criteria = 'multi_product' + AND lp.coupon_criteria IN ('multi_product', 'domain') """, ) # coupon_criteria_ids to loyalty_criteria_ids