forked from OCA/OpenUpgrade
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ADD] Apriori: 'stock_picking_backorder_strategy' merged into 'stock'.
[MIG] stock: - Rename stock_picking_type field 'backorder_strategy' -> 'create_backorder'; - Map values : {'manual': 'ask', 'no_create': 'never', 'cancel': never', 'create': 'always'}
- Loading branch information
1 parent
73c8df2
commit 52d5646
Showing
2 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
openupgrade_scripts/scripts/stock/16.0.1.1/post-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,30 @@ | ||
# Copyright (C) 2023-Today GRAP (http://www.grap.coop) | ||
# @author Sylvain LE GAL (https://twitter.com/legalsylvain) | ||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html | ||
|
||
from openupgradelib import openupgrade | ||
|
||
|
||
def handle_stock_picking_backorder_strategy(env): | ||
# Handle the merge of OCA/stock-logistics-workflow/stock_picking_backorder_strategy | ||
# feature in odoo/stock V16 module. | ||
if openupgrade.column_exists( | ||
env.cr, "stock_picking_type", openupgrade.get_legacy_name("backorder_strategy") | ||
): | ||
openupgrade.map_values( | ||
env.cr, | ||
openupgrade.get_legacy_name("backorder_strategy"), | ||
"create_backorder", | ||
[ | ||
("manual", "ask"), | ||
("create", "always"), | ||
("no_create", "never"), | ||
("cancel", "never"), | ||
], | ||
table="stock_picking_type", | ||
) | ||
|
||
|
||
@openupgrade.migrate() | ||
def migrate(env, version): | ||
handle_stock_picking_backorder_strategy(env) |
25 changes: 25 additions & 0 deletions
25
openupgrade_scripts/scripts/stock/16.0.1.1/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,25 @@ | ||
# Copyright (C) 2023-Today GRAP (http://www.grap.coop) | ||
# @author Sylvain LE GAL (https://twitter.com/legalsylvain) | ||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html | ||
|
||
from openupgradelib import openupgrade | ||
|
||
|
||
def handle_stock_picking_backorder_strategy(env): | ||
# Handle the merge of OCA/stock-logistics-workflow/stock_picking_backorder_strategy | ||
# feature in odoo/stock V16 module. | ||
if openupgrade.column_exists(env.cr, "stock_picking_type", "backorder_strategy"): | ||
# Rename column | ||
openupgrade.rename_columns( | ||
env.cr, | ||
{ | ||
"stock_picking_type": [ | ||
("backorder_strategy", None), | ||
], | ||
}, | ||
) | ||
|
||
|
||
@openupgrade.migrate() | ||
def migrate(env, version): | ||
handle_stock_picking_backorder_strategy(env) |