[FIX] purchase_stock: avoid PO exception propagation to DONE receipts on less received quants
Before this commit: 1. Create PO with quantity 10, confirm (creates receipt-1) 2. Receive 2 quantities on first receipt (receipt-1), backorder (receipt-1 is 'done', creates receipt-2) 3. Receive 3 quantities on second receipt (receipt-2), backorder (receipt-2 is 'done', creates receipt-3) 4. Change quantity to 5 in PO 5. An exception is created on all receipts (1, 2 and 3) In the scenario above, receipt-1 and receipt-2 are partial receipts that are set to 'done'. It is not necessary to create an exception in these receipts when the quantity is changed to less than originally expected in the PO. Since the system checks that the new quantity has to be equal or greater than the received quantities, the already received quantities cannot be impacted. After this commit: The exception is only propagated to the receipts that are not done. e.g. in the example above, an exception appears only in receipt-3. task-2648209 resolves #76297 closes odoo/odoo#106597 X-original-commit: d6fad232 Signed-off-by:William Henrotin (whe) <whe@odoo.com>
Please register or sign in to comment