From 85669280157ea0f11286df27aef60833fb574076 Mon Sep 17 00:00:00 2001 From: alt-odoo Date: Wed, 29 Jun 2022 04:27:37 +0000 Subject: [PATCH] [FIX] mrp: correct logging of quantity exception note on pickings It could happen that there are other objects than stock.move linked to the manufacture order. This is currently creating an error when concatenating the objects. As we are only keeping stock.move objects to log the exception on those, we should filter them before the concatenate operation to avoid the error. closes odoo/odoo#94893 X-original-commit: 1cdb682163e24fc01677cdcd0e1b83592443fffc Signed-off-by: Arnold Moyaux (arm) Signed-off-by: Alex Thuyls (alt) Co-authored-by: vancleeff --- addons/mrp/models/mrp_production.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/mrp/models/mrp_production.py b/addons/mrp/models/mrp_production.py index 0ff2bd4e7b1..7393133e070 100644 --- a/addons/mrp/models/mrp_production.py +++ b/addons/mrp/models/mrp_production.py @@ -1933,9 +1933,10 @@ class MrpProduction(models.Model): order_exception, visited = exception order_exceptions.update(order_exception) visited_objects += visited - visited_objects = self.env[visited_objects[0]._name].concat(*visited_objects) + visited_objects = [sm for sm in visited_objects if sm._name == 'stock.move'] impacted_object = [] - if visited_objects and visited_objects._name == 'stock.move': + if visited_objects: + visited_objects = self.env[visited_objects[0]._name].concat(*visited_objects) visited_objects |= visited_objects.mapped('move_orig_ids') impacted_object = visited_objects.filtered(lambda m: m.state not in ('done', 'cancel')).mapped('picking_id') values = {