odoo-addon-openupgrade-scripts 16.0.1.0.3.289__py3-none-any.whl → 16.0.1.0.3.291__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.
- odoo/addons/openupgrade_scripts/scripts/sale_loyalty/16.0.1.0/post-migration.py +59 -0
- odoo/addons/openupgrade_scripts/scripts/sale_loyalty/16.0.1.0/pre-migration.py +0 -73
- {odoo_addon_openupgrade_scripts-16.0.1.0.3.289.dist-info → odoo_addon_openupgrade_scripts-16.0.1.0.3.291.dist-info}/METADATA +1 -1
- {odoo_addon_openupgrade_scripts-16.0.1.0.3.289.dist-info → odoo_addon_openupgrade_scripts-16.0.1.0.3.291.dist-info}/RECORD +6 -6
- {odoo_addon_openupgrade_scripts-16.0.1.0.3.289.dist-info → odoo_addon_openupgrade_scripts-16.0.1.0.3.291.dist-info}/WHEEL +0 -0
- {odoo_addon_openupgrade_scripts-16.0.1.0.3.289.dist-info → odoo_addon_openupgrade_scripts-16.0.1.0.3.291.dist-info}/top_level.txt +0 -0
@@ -36,6 +36,63 @@ 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
|
+
|
75
|
+
def _generate_sale_order_coupon_points(env):
|
76
|
+
openupgrade.logged_query(
|
77
|
+
env.cr,
|
78
|
+
"""
|
79
|
+
INSERT INTO sale_order_coupon_points (
|
80
|
+
coupon_id, order_id, points, create_uid, write_uid, create_date, write_date
|
81
|
+
)
|
82
|
+
SELECT
|
83
|
+
id AS coupon_id,
|
84
|
+
order_id,
|
85
|
+
points,
|
86
|
+
create_uid,
|
87
|
+
write_uid,
|
88
|
+
create_date,
|
89
|
+
write_date
|
90
|
+
FROM loyalty_card
|
91
|
+
WHERE order_id IS NOT NULL;
|
92
|
+
""",
|
93
|
+
)
|
94
|
+
|
95
|
+
|
39
96
|
@openupgrade.migrate()
|
40
97
|
def migrate(env, version):
|
41
98
|
openupgrade.load_data(env.cr, "sale_loyalty", "16.0.1.0/noupdate_changes.xml")
|
@@ -45,3 +102,5 @@ def migrate(env, version):
|
|
45
102
|
)
|
46
103
|
convert_applied_coupons_from_sale_order_to_many2many(env)
|
47
104
|
fill_code_enabled_rule_ids_from_sale_order(env)
|
105
|
+
merge_sale_gift_card_to_sale_loyalty_card(env)
|
106
|
+
_generate_sale_order_coupon_points(env)
|
@@ -38,41 +38,6 @@ def _generate_random_reward_code():
|
|
38
38
|
return str(random.getrandbits(32))
|
39
39
|
|
40
40
|
|
41
|
-
def generate_sale_order_coupon_points(env):
|
42
|
-
openupgrade.logged_query(
|
43
|
-
env.cr,
|
44
|
-
"""
|
45
|
-
CREATE TABLE IF NOT EXISTS sale_order_coupon_points (
|
46
|
-
coupon_id INT,
|
47
|
-
order_id INT,
|
48
|
-
points FLOAT,
|
49
|
-
create_uid INT,
|
50
|
-
write_uid INT,
|
51
|
-
create_date DATE,
|
52
|
-
write_date DATE
|
53
|
-
)
|
54
|
-
""",
|
55
|
-
)
|
56
|
-
openupgrade.logged_query(
|
57
|
-
env.cr,
|
58
|
-
"""
|
59
|
-
INSERT INTO sale_order_coupon_points (
|
60
|
-
coupon_id, order_id, points, create_uid, write_uid, create_date, write_date
|
61
|
-
)
|
62
|
-
SELECT
|
63
|
-
id AS coupon_id,
|
64
|
-
order_id,
|
65
|
-
points,
|
66
|
-
create_uid,
|
67
|
-
write_uid,
|
68
|
-
create_date,
|
69
|
-
write_date
|
70
|
-
FROM loyalty_card
|
71
|
-
WHERE order_id IS NOT NULL;
|
72
|
-
""",
|
73
|
-
)
|
74
|
-
|
75
|
-
|
76
41
|
def update_loyalty_program_data(env):
|
77
42
|
# Set sale_ok default values
|
78
43
|
if not openupgrade.column_exists(env.cr, "loyalty_program", "sale_ok"):
|
@@ -208,48 +173,10 @@ def update_template_keys(env):
|
|
208
173
|
)
|
209
174
|
|
210
175
|
|
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
176
|
@openupgrade.migrate()
|
248
177
|
def migrate(env, version):
|
249
178
|
openupgrade.rename_xmlids(env.cr, _xmlids_renames)
|
250
|
-
generate_sale_order_coupon_points(env)
|
251
179
|
update_loyalty_program_data(env)
|
252
180
|
update_sale_order_line_data(env)
|
253
181
|
delete_sql_constraints(env)
|
254
182
|
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.
|
3
|
+
Version: 16.0.1.0.3.291
|
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=
|
545
|
-
odoo/addons/openupgrade_scripts/scripts/sale_loyalty/16.0.1.0/pre-migration.py,sha256=
|
544
|
+
odoo/addons/openupgrade_scripts/scripts/sale_loyalty/16.0.1.0/post-migration.py,sha256=8_6iBdeGq78GFcrhKkhmkZ-v7Sd5DocFpouxgEdDUwA,3531
|
545
|
+
odoo/addons/openupgrade_scripts/scripts/sale_loyalty/16.0.1.0/pre-migration.py,sha256=Z5D8YjCb483BCMwxJXLa21wbqzPiMwPe0pmcsqDTAhA,4908
|
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.
|
724
|
-
odoo_addon_openupgrade_scripts-16.0.1.0.3.
|
725
|
-
odoo_addon_openupgrade_scripts-16.0.1.0.3.
|
726
|
-
odoo_addon_openupgrade_scripts-16.0.1.0.3.
|
723
|
+
odoo_addon_openupgrade_scripts-16.0.1.0.3.291.dist-info/METADATA,sha256=fLPSEvDjyn8MZSM4LK75JOawwhupmuhL6rIeVFBz0J8,3790
|
724
|
+
odoo_addon_openupgrade_scripts-16.0.1.0.3.291.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
725
|
+
odoo_addon_openupgrade_scripts-16.0.1.0.3.291.dist-info/top_level.txt,sha256=qBj40grFkGOfDZ2WDSw3y1RnDlgG0u8rP8pvGNdbz4w,5
|
726
|
+
odoo_addon_openupgrade_scripts-16.0.1.0.3.291.dist-info/RECORD,,
|
File without changes
|