From 97035d195d522a749f07051a946a8a7fd00487bb Mon Sep 17 00:00:00 2001 From: pilarvargas-tecnativa Date: Mon, 15 Jul 2024 16:05:58 +0200 Subject: [PATCH] [FIX] loyalty_multi_gift: Transfer m2m data to new table By changing the name of the template, the relationship table of the field "reward_product_ids" with the template "loyalty.reward.product_line" formerly "coupon.reward.product_line" changes so the data from the old table has to be moved to the new one. TT44321 --- .../migrations/16.0.1.0.0/post-migration.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 loyalty_multi_gift/migrations/16.0.1.0.0/post-migration.py diff --git a/loyalty_multi_gift/migrations/16.0.1.0.0/post-migration.py b/loyalty_multi_gift/migrations/16.0.1.0.0/post-migration.py new file mode 100644 index 00000000..0265c52b --- /dev/null +++ b/loyalty_multi_gift/migrations/16.0.1.0.0/post-migration.py @@ -0,0 +1,16 @@ +# Copyright 2024 Tecnativa - Pilar Vargas +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +from openupgradelib import openupgrade + + +@openupgrade.migrate() +def migrate(env, version): + openupgrade.logged_query( + env.cr, + """ + INSERT INTO loyalty_reward_product_line_product_product_rel + (loyalty_reward_product_line_id, product_product_id) + SELECT coupon_reward_product_line_id, product_product_id + FROM coupon_reward_product_line_product_product_rel + """, + )