-
-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIG] sale_coupon_order_line_link: Renamed to sale_loyalty_order_line…
…_link + Migration to version 16.0 TT44349
- Loading branch information
1 parent
5653957
commit 824bd8e
Showing
17 changed files
with
268 additions
and
261 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
# Copyright 2021 Tecnativa - David Vidal | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
{ | ||
"name": "Link coupons to order lines", | ||
"summary": "Adds a link between coupons and their generated order lines for easing " | ||
"tracking", | ||
"version": "15.0.1.0.0", | ||
"name": "Link loyalty programs to order lines", | ||
"summary": "Adds a link between loyalty programs and their generated order lines" | ||
"for easing tracking", | ||
"version": "16.0.1.0.0", | ||
"development_status": "Production/Stable", | ||
"category": "Sale", | ||
"website": "https://github.com/OCA/sale-promotion", | ||
"author": "Tecnativa, Odoo Community Association (OCA)", | ||
"maintainers": ["chienandalu"], | ||
"license": "AGPL-3", | ||
"depends": ["sale_coupon"], | ||
"depends": ["sale_loyalty"], | ||
"data": ["reports/sale_report_views.xml", "views/sale_order_views.xml"], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
sale_loyalty_order_line_link/migrations/16.0.1.0.0/pre-migration.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Copyright 2023 Tecnativa - Pilar Vargas | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
from openupgradelib import openupgrade | ||
|
||
_renamed_fields = [ | ||
( | ||
"sale.order.line", | ||
"sale_order_line", | ||
"coupon_program_id", | ||
"loyalty_program_id", | ||
), | ||
] | ||
|
||
|
||
@openupgrade.migrate() | ||
def migrate(env, version): | ||
openupgrade.rename_fields(env, _renamed_fields) | ||
openupgrade.logged_query( | ||
env.cr, | ||
""" | ||
ALTER TABLE sale_order_line | ||
ADD COLUMN IF NOT EXISTS reward_id INTEGER; | ||
""", | ||
) | ||
openupgrade.logged_query( | ||
env.cr, | ||
""" | ||
UPDATE sale_order_line AS sol | ||
SET sol.reward_id = lr.id | ||
FROM loyalty_reward AS lr | ||
WHERE sol.loyalty_program_id = lr.program_id | ||
AND sol.loyalty_program_id IS NOT NULL; | ||
""", | ||
) |
Oops, something went wrong.