From e60df3776049e5d6acc1e358030b37323269eee6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Voet=20=28ryv=29?= Date: Wed, 18 Nov 2020 14:15:12 +0000 Subject: [PATCH] [FIX] stock: fix `_compute_outdated` of `stock.inventory.line` The compute `_compute_outdated` of `stock.inventory.line` didn't manage inventory lines of different `inventory_id` because of the ensure_one of `_get_quantities` (coming from 68518afe33040ff6e000a15acd3a7080b2485e38). Call `_get_quantities` by inventory and save it in a dict to be use in the loop after. closes odoo/odoo#62000 X-original-commit: e369f15a9194b530c14ad1c796e4f10b80338260 Signed-off-by: William Henrotin --- addons/stock/models/stock_inventory.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/stock/models/stock_inventory.py b/addons/stock/models/stock_inventory.py index 3b5f0f51050..560b43e0ae1 100644 --- a/addons/stock/models/stock_inventory.py +++ b/addons/stock/models/stock_inventory.py @@ -393,8 +393,9 @@ class InventoryLine(models.Model): @api.depends('inventory_date', 'product_id.stock_move_ids', 'theoretical_qty', 'product_uom_id.rounding') def _compute_outdated(self): - quants = self.inventory_id._get_quantities() + quants_by_inventory = {inventory: inventory._get_quantities() for inventory in self.inventory_id} for line in self: + quants = quants_by_inventory[line.inventory_id] if line.state == 'done' or not line.id: line.outdated = False continue