[FIX] mrp: validate a MO with manual consumption
Steps to reproduce the bug:
- Create a storable produce P1 with BoM:
- select any component, qty: 1 unit
- Create a MO to produce one unit of P1
- Confirm the MO
- Update the qty of the component to 2
- Validate the MO
Problem:
The quantity of the component is overwritten and reset to 1
Because, when the new qty of the component is set, only the
“manual_consumption” field is updated to “True” thanks to their compute:
https://github.com/odoo/odoo/blob/17.0/addons/mrp/models/stock_move.py#L138-L145
But the field ‘picked’, is not updated
So when we check if we have to set a quantity, the condition is false
and the quantity is reset to the original value:
https://github.com/odoo/odoo/blob/26193fdb707a631d498cbc37d68c08497e32a31d/addons/mrp/models/mrp_production.py#L1201-L1202
opw-3616628
closes odoo/odoo#145157
Signed-off-by: William Henrotin (whe) <whe@odoo.com>