[FIX] mrp: update MO quantity when there are more than one move per line

The production.move_raw_ids usually contains only one move per bom_line_id;
it might not always be the case, as ccbd6712f6 used move[0] to get a singleton.
The following calls to _get_document_iterate_key, _log_activity_get_documents,
also require move to be a singleton, so we use replace move by move[0].

opw 2042099

closes odoo/odoo#35206

Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
This commit is contained in:
Nans Lefebvre
2019-07-26 08:28:17 +00:00
parent c9a061b9c0
commit f97b766013
+2 -1
View File
@@ -56,7 +56,8 @@ class ChangeProductionQty(models.TransientModel):
for line, line_data in lines:
move = production.move_raw_ids.filtered(lambda x: x.bom_line_id.id == line.id and x.state not in ('done', 'cancel'))
if move:
old_qty = move[0].product_uom_qty
move = move[0]
old_qty = move.product_uom_qty
else:
old_qty = 0
iterate_key = production._get_document_iterate_key(move)