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

[FIX] mrp: produce wizard negative reserved qty

Usecase to reproduce:
BOM 1 product final F -> 2 components C
- 1 units of C in stock
- MO of 2 units of F
- Reserve MO
- Produce wizard 2 units of F -> C 4 to consume 1 reserved
- Update quantity to 1

-> The produce line for C contains -1 reserved

It happens because the system remove the quantity to consume on
the reservation. However sometimes the quantity reserved is lower
than the quantity to consume and it will result in a negative quantity
reserved.
parent 4ed25f56
Branches
Tags
No related merge requests found
......@@ -75,10 +75,11 @@ class MrpAbstractWorkorder(models.AbstractModel):
line_values['to_delete'] = workorder_line
else:
new_val = workorder_line.qty_to_consume - qty_todo
new_reserved = max(0, workorder_line.qty_reserved - qty_todo)
line_values['to_update'][workorder_line] = {
'qty_to_consume': new_val,
'qty_done': new_val,
'qty_reserved': new_val,
'qty_reserved': new_reserved,
}
qty_todo = 0
else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment