[FIX] mrp: create PBM SM from confirmed MO
To reproduce the issue: 1. In Settings, enable "Multi Routes" 2. Edit the warehouse: - Manufacture: 2 steps 3. Create three storable products P1, P2, P3 4. Create and confirm a MO for 1 x P1 with 1 x P2 - It should create the PBM picking 5. Add a component line for P3 6. (Because the MO is locked, the user can not edit the 'to consume' quantity, so) Unlock the MO 7. Set the 'to consume' qty to 1 8. Save the MO Error: P3 is not added to PBM picking. Worst: suppose the user does the internal transfer and then checks the availability of P3, the line will still be unreserved Step 6, when unlocking the MO, it also triggers a save. As a result, the SM for P3 is created with its demand defined to 0. When adding such SM, we do several things through this method call: https://github.com/odoo/odoo/blob/be0b61cbaf3d3b7082aca8f96dcf8a6ee7885fea/addons/mrp/models/mrp_production.py#L776 - We will adapt its procure method (here, because of 2-steps manufacturing, it will be MTO) - We will confirm the new SM -> we will run a procurement for a zero quantity -> it will not generate any new SM Then, when updating the SM quantity (step 7), nothing will run a new procurement. Moreover, this also explains why trying to reserve the SM does not work: it's an MTO one, but it does not have any `move_orig_ids`, so it is not possible to assign it. Solutions: - It should be possible to edit the 'to consume' qty of a new SM, even on a locked and confirmed MO - A procurement should be executed when updating the demand of an SM from 0 to >0. From 16.1, a procurement will always be executed each time the quantity changed (see [1]). Here, we want to limit the impact/risk of the fix [1] 1f4fb64a OPW-3253204 closes odoo/odoo#135478 Signed-off-by:William Henrotin (whe) <whe@odoo.com>
Showing
Loading
Please register or sign in to comment