From 02ad90ee75cdbb08ab6518527465a4b1b47dec29 Mon Sep 17 00:00:00 2001 From: "Tiffany Chang (tic)" Date: Thu, 15 Sep 2022 08:49:55 +0000 Subject: [PATCH] [FIX] stock: correctly trigger loc warehouse compute Commit [1] made it so the computed stock_location.warehouse_id field is stored. Unfortunately it did not correctly add the additional depends value of `location_id` so when this value is changed after the record has been initially created+saved without a location_id, the warehouse will never be correctly computed. [1] https://github.com/odoo/odoo/commit/9978bcb366d0ea48ed25a7891e0c7653a2f96bfb Followup to task: 2882539 closes odoo/odoo#100219 Related: odoo/upgrade#3901 Signed-off-by: Arnold Moyaux (arm) --- addons/stock/models/stock_location.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/stock/models/stock_location.py b/addons/stock/models/stock_location.py index 6655f11dad1..d2eee51f355 100644 --- a/addons/stock/models/stock_location.py +++ b/addons/stock/models/stock_location.py @@ -146,7 +146,7 @@ class Location(models.Model): else: location.next_inventory_date = False - @api.depends('warehouse_view_ids') + @api.depends('warehouse_view_ids', 'location_id') def _compute_warehouse_id(self): warehouses = self.env['stock.warehouse'].search([('view_location_id', 'parent_of', self.ids)]) view_by_wh = OrderedDict((wh.view_location_id.id, wh.id) for wh in warehouses)