[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) <arm@odoo.com>
Signed-off-by: Alex Thuyls (alt) <alt@odoo.com>
Co-authored-by: vancleeff <mvw@odoo.com>
This commit is contained in:
alt-odoo
2022-06-29 18:55:17 +02:00
co-authored by vancleeff
parent 6b23d8a2ca
commit 8566928015
+3 -2
View File
@@ -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 = {