[FIX] stock: barckorder on move with mulitple move_line

When a move is set to done and a backorder should be create, we get a
traceback saying that we cannot set the quantity done on a move with
multiple move move_lines.

This occurs, when the stock move has multiple move lines with quantity
done set to 0;

Because the new move only contains move lines having quantity done 0, we
remove the useless line that set the quantity done on the move
This commit is contained in:
Pierre Masereel
2017-09-14 11:25:26 +02:00
parent 4a878fa4dc
commit 858cb6534b
-1
View File
@@ -913,7 +913,6 @@ class StockMove(models.Model):
# If you were already putting stock.move.lots on the next one in the work order, transfer those to the new move
move.move_line_ids.filtered(lambda x: x.qty_done == 0.0).write({'move_id': new_move})
self.browse(new_move).quantity_done = 0.0
move.move_line_ids.action_done()
picking = self and self[0].picking_id or False
moves_todo.write({'state': 'done', 'date': fields.Datetime.now()})