odoo-addon-openupgrade-scripts 16.0.1.0.3.289__py3-none-any.whl → 16.0.1.0.3.290__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -36,6 +36,42 @@ def fill_code_enabled_rule_ids_from_sale_order(env):
36
36
  )
37
37
 
38
38
 
39
+ def merge_sale_gift_card_to_sale_loyalty_card(env):
40
+ # Update the coupon_id column in the sale_order_line table with the ID of the
41
+ # loyalty_card table based on certain criteria and relationships established between
42
+ # the loyalty_card, loyalty_reward and gift_card tables
43
+ # program_id is added to the gift_card table in the loyalty migration script.
44
+ if not openupgrade.table_exists(env.cr, "gift_card"):
45
+ return
46
+ openupgrade.logged_query(
47
+ env.cr,
48
+ """
49
+ UPDATE sale_order_line AS sol
50
+ SET coupon_id = lc.id
51
+ FROM loyalty_card AS lc
52
+ JOIN loyalty_reward AS lr ON lc.program_id = lr.program_id
53
+ JOIN gift_card AS gc ON lc.program_id = gc.program_id
54
+ WHERE sol.reward_id = lr.id
55
+ AND lr.program_id = lc.program_id
56
+ AND lc.program_id = gc.program_id
57
+ AND sol.gift_card_id = gc.id
58
+ AND sol.reward_id IS NOT NULL
59
+ """,
60
+ )
61
+ # Values corresponding to the order_id and coupon_id columns of the sale_order_line
62
+ # table where reward_id is not null and gift_card_id is not null
63
+ openupgrade.logged_query(
64
+ env.cr,
65
+ """
66
+ INSERT INTO loyalty_card_sale_order_rel (sale_order_id, loyalty_card_id)
67
+ SELECT sol.order_id, sol.coupon_id
68
+ FROM sale_order_line AS sol
69
+ WHERE sol.reward_id IS NOT NULL
70
+ AND sol.gift_card_id IS NOT NULL
71
+ """,
72
+ )
73
+
74
+
39
75
  @openupgrade.migrate()
40
76
  def migrate(env, version):
41
77
  openupgrade.load_data(env.cr, "sale_loyalty", "16.0.1.0/noupdate_changes.xml")
@@ -45,3 +81,4 @@ def migrate(env, version):
45
81
  )
46
82
  convert_applied_coupons_from_sale_order_to_many2many(env)
47
83
  fill_code_enabled_rule_ids_from_sale_order(env)
84
+ merge_sale_gift_card_to_sale_loyalty_card(env)
@@ -208,42 +208,6 @@ def update_template_keys(env):
208
208
  )
209
209
 
210
210
 
211
- def merge_sale_gift_card_to_sale_loyalty_card(env):
212
- # Update the coupon_id column in the sale_order_line table with the ID of the
213
- # loyalty_card table based on certain criteria and relationships established between
214
- # the loyalty_card, loyalty_reward and gift_card tables
215
- # program_id is added to the gift_card table in the loyalty migration script.
216
- if not openupgrade.table_exists(env.cr, "gift_card"):
217
- return
218
- openupgrade.logged_query(
219
- env.cr,
220
- """
221
- UPDATE sale_order_line AS sol
222
- SET coupon_id = lc.id
223
- FROM loyalty_card AS lc
224
- JOIN loyalty_reward AS lr ON lc.program_id = lr.program_id
225
- JOIN gift_card AS gc ON lc.program_id = gc.program_id
226
- WHERE sol.reward_id = lr.id
227
- AND lr.program_id = lc.program_id
228
- AND lc.program_id = gc.program_id
229
- AND sol.gift_card_id = gc.id
230
- AND sol.reward_id IS NOT NULL
231
- """,
232
- )
233
- # Values corresponding to the order_id and coupon_id columns of the sale_order_line
234
- # table where reward_id is not null and gift_card_id is not null
235
- openupgrade.logged_query(
236
- env.cr,
237
- """
238
- INSERT INTO loyalty_card_sale_order_rel (sale_order_id, loyalty_card_id)
239
- SELECT sol.order_id, sol.coupon_id
240
- FROM sale_order_line AS sol
241
- WHERE sol.reward_id IS NOT NULL
242
- AND sol.gift_card_id IS NOT NULL
243
- """,
244
- )
245
-
246
-
247
211
  @openupgrade.migrate()
248
212
  def migrate(env, version):
249
213
  openupgrade.rename_xmlids(env.cr, _xmlids_renames)
@@ -252,4 +216,3 @@ def migrate(env, version):
252
216
  update_sale_order_line_data(env)
253
217
  delete_sql_constraints(env)
254
218
  update_template_keys(env)
255
- merge_sale_gift_card_to_sale_loyalty_card(env)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: odoo-addon-openupgrade_scripts
3
- Version: 16.0.1.0.3.289
3
+ Version: 16.0.1.0.3.290
4
4
  Summary: Module that contains all the migrations analysis and scripts for migrate Odoo SA modules.
5
5
  Home-page: https://github.com/OCA/OpenUpgrade
6
6
  Author: Odoo Community Association (OCA)
@@ -541,8 +541,8 @@ odoo/addons/openupgrade_scripts/scripts/sale_expense/16.0.1.0/upgrade_analysis.t
541
541
  odoo/addons/openupgrade_scripts/scripts/sale_expense/16.0.1.0/upgrade_analysis_work.txt,sha256=DmrK92lmPdYQB-pJP0_8i9ozThLVJogDTDBcyZ6WXFU,587
542
542
  odoo/addons/openupgrade_scripts/scripts/sale_expense_margin/16.0.1.0/upgrade_analysis.txt,sha256=gabpy2-wJy26_KlOM7Uz_e08g2b0cOLYN-J-beuCyrQ,246
543
543
  odoo/addons/openupgrade_scripts/scripts/sale_loyalty/16.0.1.0/noupdate_changes.xml,sha256=zw3hSulldqaK5T1tq4zS6yBkJYZDAJLkd19r2uNgBKM,298
544
- odoo/addons/openupgrade_scripts/scripts/sale_loyalty/16.0.1.0/post-migration.py,sha256=1gAPGADAmiWI5NuDGE2jpjgF2BjDiKQ8hNDvgoqPkfU,1508
545
- odoo/addons/openupgrade_scripts/scripts/sale_loyalty/16.0.1.0/pre-migration.py,sha256=TF4i0ilzK1ThtLXsepbzSJZhQx-SdfuUeTCzaBdR3ZQ,7270
544
+ odoo/addons/openupgrade_scripts/scripts/sale_loyalty/16.0.1.0/post-migration.py,sha256=9f8HSvLthyGwd0UvimC3WWX9NEeMAayapvD-IF8QBcI,2975
545
+ odoo/addons/openupgrade_scripts/scripts/sale_loyalty/16.0.1.0/pre-migration.py,sha256=UzE7QFpIdMhaiKeQXzQaz9bfl5Df6QKhpmemxdkAJzY,5803
546
546
  odoo/addons/openupgrade_scripts/scripts/sale_loyalty/16.0.1.0/upgrade_analysis.txt,sha256=VWql2XMcz2AZ1FHQSCzNY8l9Zy11El0CbNOjAT3UEzk,7202
547
547
  odoo/addons/openupgrade_scripts/scripts/sale_loyalty/16.0.1.0/upgrade_analysis_work.txt,sha256=wf_RFWboON8nx71Gj7PfmFHONbzbYNc868SsSDsYFE4,7950
548
548
  odoo/addons/openupgrade_scripts/scripts/sale_loyalty_delivery/16.0.1.0/pre-migration.py,sha256=ZZyj0sWEVwjqRZp9qUjuIKloekIKuvR_HiuSFKrGcAs,1192
@@ -720,7 +720,7 @@ odoo/addons/openupgrade_scripts/scripts/website_twitter/16.0.1.0/upgrade_analysi
720
720
  odoo/addons/openupgrade_scripts/static/description/banner.png,sha256=KTIBu4gfxeZVw9zjs_fivTgFEOeaAorlBxajmCA1p6k,26859
721
721
  odoo/addons/openupgrade_scripts/static/description/icon.png,sha256=6xBPJauaFOF0KDHfHgQopSc28kKvxMaeoQFQWZtfZDo,9455
722
722
  odoo/addons/openupgrade_scripts/static/description/index.html,sha256=IOWtZdzr_jN_Dja8HYIfzIxrO8NE5pFgazKJtPsLKw0,12678
723
- odoo_addon_openupgrade_scripts-16.0.1.0.3.289.dist-info/METADATA,sha256=Kos6vQDOVNNV2ECXtluFgkVJXyHA-UZ3cSdR_h88Odo,3790
724
- odoo_addon_openupgrade_scripts-16.0.1.0.3.289.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
725
- odoo_addon_openupgrade_scripts-16.0.1.0.3.289.dist-info/top_level.txt,sha256=qBj40grFkGOfDZ2WDSw3y1RnDlgG0u8rP8pvGNdbz4w,5
726
- odoo_addon_openupgrade_scripts-16.0.1.0.3.289.dist-info/RECORD,,
723
+ odoo_addon_openupgrade_scripts-16.0.1.0.3.290.dist-info/METADATA,sha256=d5ttkmkc_aDcgdv8H57RLjAlgqkCp-GLNWeQy5VtVZY,3790
724
+ odoo_addon_openupgrade_scripts-16.0.1.0.3.290.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
725
+ odoo_addon_openupgrade_scripts-16.0.1.0.3.290.dist-info/top_level.txt,sha256=qBj40grFkGOfDZ2WDSw3y1RnDlgG0u8rP8pvGNdbz4w,5
726
+ odoo_addon_openupgrade_scripts-16.0.1.0.3.290.dist-info/RECORD,,