Skip to content
Snippets Groups Projects
Commit 4ed25f56 authored by Arnold Moyaux's avatar Arnold Moyaux
Browse files

[FIX] mrp: remove unreserved line first

Since the quantity producing could change on the produce
wizard. The first quantity to remove is the quantity not
reserved on the MO.
parent ce355c97
Branches
Tags
No related merge requests found
......@@ -63,7 +63,7 @@ class MrpAbstractWorkorder(models.AbstractModel):
# Remove or lower quantity on exisiting workorder lines
if float_compare(qty_todo, 0.0, precision_rounding=rounding) < 0:
qty_todo = abs(qty_todo)
for workorder_line in move_workorder_lines:
for workorder_line in move_workorder_lines.sorted(key=lambda wl: wl.qty_reserved):
if float_compare(qty_todo, 0, precision_rounding=rounding) <= 0:
break
if float_compare(workorder_line.qty_to_consume, qty_todo, precision_rounding=rounding) <= 0:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment