diff --git a/openupgrade_scripts/scripts/stock/17.0.1.1/pre-migration.py b/openupgrade_scripts/scripts/stock/17.0.1.1/pre-migration.py index 82bf533645a9..5efba96a2227 100644 --- a/openupgrade_scripts/scripts/stock/17.0.1.1/pre-migration.py +++ b/openupgrade_scripts/scripts/stock/17.0.1.1/pre-migration.py @@ -13,6 +13,36 @@ } +def _pre_stock_picking_picking_properties(env): + """Avoid triggering the computed method""" + openupgrade.logged_query( + env.cr, + """ + ALTER TABLE stock_picking + ADD COLUMN IF NOT EXISTS picking_properties jsonb + """, + ) + + +def _pre_stock_move_line_picked(env): + """Avoid triggering the computed method""" + openupgrade.logged_query( + env.cr, + """ + ALTER TABLE stock_move_line + ADD COLUMN IF NOT EXISTS picked boolean + """, + ) + openupgrade.logged_query( + env.cr, + """ + UPDATE stock_move_line + SET picked = True + WHERE state = 'done'; + """, + ) + + def fix_move_line_quantity(env): """ v17 combines what used to be reserved_qty and qty_done. @@ -40,4 +70,6 @@ def fix_move_line_quantity(env): def migrate(env, version): openupgrade.rename_fields(env, _field_renames) openupgrade.copy_columns(env.cr, _column_copies) + _pre_stock_picking_picking_properties(env) + _pre_stock_move_line_picked(env) fix_move_line_quantity(env) diff --git a/openupgrade_scripts/scripts/stock/17.0.1.1/upgrade_analysis_work.txt b/openupgrade_scripts/scripts/stock/17.0.1.1/upgrade_analysis_work.txt index f8d2f74c8f05..e16cfd9edf74 100644 --- a/openupgrade_scripts/scripts/stock/17.0.1.1/upgrade_analysis_work.txt +++ b/openupgrade_scripts/scripts/stock/17.0.1.1/upgrade_analysis_work.txt @@ -45,6 +45,8 @@ stock / stock.move.line / quantity (float) : NEW ha # DONE: pre-migration stock / stock.move.line / picked (boolean) : NEW hasdefault: compute +# DONE: pre-migration: Pre-create the column for avoiding triggering the compute. + stock / stock.move.line / quant_id (many2one) : NEW relation: stock.quant stock / stock.move.line / quantity_product_uom (float) : NEW isfunction: function, stored # NOTHING TO DO @@ -66,7 +68,11 @@ stock / stock.picking / message_main_attachment_id (many2one): stock / stock.picking / move_ids_without_package (one2many): is now stored stock / stock.picking / move_ids_without_package (one2many): not a function anymore stock / stock.picking / move_line_nosuggest_ids (one2many): DEL relation: stock.move.line +# NOTHING TO DO + stock / stock.picking / picking_properties (properties): NEW hasdefault: compute +# DONE: pre-migration: Pre-create the column for avoiding triggering the compute. + stock / stock.picking / rating_ids (one2many) : NEW relation: rating.rating stock / stock.picking / show_operations (boolean) : not a function anymore stock / stock.picking / show_operations (boolean) : now related