[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
68518afe33).

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 <Whenrow@users.noreply.github.com>
This commit is contained in:
Rémy Voet (ryv)
2020-11-19 11:04:35 +00:00
parent 3cadee4170
commit e60df37760
+2 -1
View File
@@ -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