From 3d4dc153f6c075b4932edf56458ae9857813dec4 Mon Sep 17 00:00:00 2001 From: Alessandro Uffreduzzi Date: Tue, 11 Feb 2025 15:29:30 +0100 Subject: [PATCH] [FIX] stock_operating_unit: orderpoint OU check for ext locations Do not check OU on locations that do not have a warehouse at all Odoo's base `stock` module will still fill the `warehouse_id` field incorrectly with the company's default warehouse This allows the user to set reordering rules for e.g. a subcontracting location --- stock_operating_unit/model/stock_warehouse.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/stock_operating_unit/model/stock_warehouse.py b/stock_operating_unit/model/stock_warehouse.py index b63e597cbc..8eef34db8a 100644 --- a/stock_operating_unit/model/stock_warehouse.py +++ b/stock_operating_unit/model/stock_warehouse.py @@ -49,6 +49,11 @@ class StockWarehouseOrderPoint(models.Model): ) def _check_location(self): for rec in self: + # Fix: do not check OU on locations that do not have a warehouse at all + # Odoo's base `stock` module will still fill the `warehouse_id` field + # incorrectly with the company's default warehouse + if not rec.location_id.warehouse_id: + continue if ( rec.warehouse_id.operating_unit_id and rec.warehouse_id