[FIX] mrp: Upating the quantity of a MO

Steps to reproduce the bug:

- Create three stockable products P1, P2, P3
- Create a BOM for P1 with P2 and P3 as components
- Create a MO with 5 P1
- Check the availability and plan it
- Go on the WO and process only 3 P1
- Go to the MO and update the quantity to 3

Bug:

From this point, it was impossible to pass the MO to the state= 'done'

With this fix, you can now, click on "Post inventory" and the button
"Mark as Done" will appear.

opw:1874227
This commit is contained in:
Goffin Simon
2018-09-13 10:03:57 +02:00
parent cd62900878
commit daa6cea439
@@ -77,6 +77,8 @@ class ChangeProductionQty(models.TransientModel):
wo.qty_producing = quantity
if wo.qty_produced < wo.qty_production and wo.state == 'done':
wo.state = 'progress'
if wo.qty_produced == wo.qty_production and wo.state == 'progress':
wo.state = 'done'
# assign moves; last operation receive all unassigned moves
# TODO: following could be put in a function as it is similar as code in _workorders_create
# TODO: only needed when creating new moves