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
a78408e
commit 7492bea
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
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 |
---|---|---|
@@ -1,6 +1,25 @@ | ||
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) | ||
openupgrade.load_data(env.cr, "stock", "16.0.1.1/noupdate_changes.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