Skip to content

Commit

Permalink
Merge pull request #4581 from grap/16.0-apriori-stock_picking_backord…
Browse files Browse the repository at this point in the history
…er_strategy

[16.0][ADD] Apriori: 'stock_picking_backorder_strategy' merged into 'stock'.
  • Loading branch information
pedrobaeza authored Oct 10, 2024
2 parents 47eb453 + f04b29b commit 297cf23
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
21 changes: 21 additions & 0 deletions openupgrade_scripts/scripts/stock/16.0.1.1/post-migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,28 @@ def _handle_multi_location_visibility(env):
view.active = False


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_multi_location_visibility(env)
_handle_stock_picking_backorder_strategy(env)
openupgrade.load_data(env.cr, "stock", "16.0.1.1/noupdate_changes.xml")
16 changes: 16 additions & 0 deletions openupgrade_scripts/scripts/stock/16.0.1.1/pre-migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,21 @@ def _update_stock_quant_package_pack_date(env):
)


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):
openupgrade.rename_tables(env.cr, _tables_renames)
Expand All @@ -122,3 +137,4 @@ def migrate(env, version):
_update_stock_quant_package_pack_date(env)
_update_sol_product_category_name(env)
_compute_stock_location_replenish_location(env)
_handle_stock_picking_backorder_strategy(env)
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ stock / stock.picking / move_lines (one2many) : DEL re

stock / stock.picking.type / auto_show_reception_report (boolean): NEW
stock / stock.picking.type / create_backorder (selection) : NEW required, selection_keys: ['always', 'ask', 'never'], hasdefault: default
# NOTHING TO DO
# - If stock_picking_backorder_strategy was installed, data are populated with the field backorder_strategy
# - Otherwise, NOTHING TO DO

stock / stock.production.lot / activity_ids (one2many) : DEL relation: mail.activity
stock / stock.production.lot / company_id (many2one) : DEL relation: res.company, required
Expand Down

0 comments on commit 297cf23

Please sign in to comment.