From abdb635d41e5c5af90f42eb840add995cfaa902c Mon Sep 17 00:00:00 2001 From: Melody Uffreduzzi Date: Fri, 6 Nov 2026 11:00:46 +0100 Subject: [PATCH] [OU-FIX] stock: fill default locations for inactive picking types Without this fix, stock picking types that are inactive are not included in the computation, leading to the following errors ERROR ? odoo.schema: Table 'stock_picking_type': unable to set NOT NULL on column 'default_location_src_id' ERROR ? odoo.schema: Table 'stock_picking_type': unable to set NOT NULL on column 'default_location_dest_id' --- .../scripts/stock/18.0.1.1/end-migration.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) 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..1694a729dda2 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,13 +4,10 @@ def fill_stock_picking_type_default_locations(env): - picking_types = env["stock.picking.type"].search( - [("default_location_src_id", "=", False)] - ) + PickingType = env["stock.picking.type"].with_context(active_test=False) + picking_types = PickingType.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 = PickingType.search([("default_location_dest_id", "=", False)]) picking_types._compute_default_location_dest_id()