diff --git a/openupgrade_scripts/scripts/stock/18.0.1.1/end-migration.py b/openupgrade_scripts/scripts/stock/18.0.1.1/end-migration.py index 6f1449d6639b..b70813c9119b 100644 --- a/openupgrade_scripts/scripts/stock/18.0.1.1/end-migration.py +++ b/openupgrade_scripts/scripts/stock/18.0.1.1/end-migration.py @@ -4,12 +4,18 @@ def fill_stock_picking_type_default_locations(env): - picking_types = env["stock.picking.type"].search( - [("default_location_src_id", "=", False)] + # active_test=False: archived picking types need the fill too, otherwise + # the SET NOT NULL on both columns (required since 18.0) keeps failing + picking_types = ( + env["stock.picking.type"] + .with_context(active_test=False) + .search([("default_location_src_id", "=", False)]) ) picking_types._compute_default_location_src_id() - picking_types = env["stock.picking.type"].search( - [("default_location_dest_id", "=", False)] + picking_types = ( + env["stock.picking.type"] + .with_context(active_test=False) + .search([("default_location_dest_id", "=", False)]) ) picking_types._compute_default_location_dest_id()