Skip to content

Commit

Permalink
[FIX] loyalty_criteria_multi_product: Complete loyalty_rule table data
Browse files Browse the repository at this point in the history
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
  • Loading branch information
pilarvargas-tecnativa committed Jul 15, 2024
1 parent 47fb9c7 commit 6ef8586
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6ef8586

Please sign in to comment.