Files
odoo_source/addons/mrp_subcontracting
Goffin Simon 403c687869 [FIX] mrp_subcontracting: Error Message with partial delivery
Steps to reproduce:

- Create a product P with route 'Resupply subcontractor on an order'
- Let's consider a BOM for P with type 'Subcontracting'
- Create a PO with subcontractor set on that product and process with Qty > 1,
- Validate a receipt with partial Qty and no backorder

Bug:

An error was raised because no production_id was set when trying to create a mrp.product.produce

When function _action_done is called with cancel_backorder = True, the function _action_cancel is called on the new_move
with no backorder and it called the function _action_cancel defined on model stock.move in module mrp_subcontracting
This function called _action_cancel on the mrp.production record MP
And finally this function called action_cancel on model stock.move on all finish_moves and raw_moves of MP

This line unlink MP of finish_moves and raw_moves

move.move_dest_ids.write({'move_orig_ids': [(3, move.id, 0)]})

That's why production_id was not set

PS: In this way, we don't cancel a MO when it is still used by other moves.

opw:2322278

closes odoo/odoo#57346

X-original-commit: e4d22d390c8aa8edf757e36704a9e04b2b89f115
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
2020-09-09 10:29:26 +00:00
..
…
…