Skip to content
Snippets Groups Projects
Commit 30096e8a authored by Jérôme Hellinckx's avatar Jérôme Hellinckx
Browse files

[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: default avatarWilliam Henrotin (whe) <whe@odoo.com>
parent 76367ef8
No related branches found
No related tags found
No related merge requests found
......@@ -179,7 +179,7 @@ class PurchaseOrder(models.Model):
filtered_documents = {}
for (parent, responsible), rendering_context in documents.items():
if parent._name == 'stock.picking':
if parent.state == 'cancel':
if parent.state in ['cancel', 'done']:
continue
filtered_documents[(parent, responsible)] = rendering_context
self.env['stock.picking']._log_activity(_render_note_exception_quantity_po, filtered_documents)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment