Skip to content

Commit 230f164

Browse files
committed
[FIX] purchase_stock: restrict recomputation of qty_received_method to unconfirmed POs
This commit adds a search restriction on _compute_qty_received_method which will prevent the received method field from recomputing on orders that have already been finished. This method is only called on the installation of this module and is used to update order lines of consumable products to use the standard computation of stock moves. In cases where purchase orders were completed ahead of this module's installation, this method effectively undoes all received quantities and resets them to zero. In orders that were already confirmed and billed, this displays the order lines with zero received quantities and no way to functionally change it. opw-2854810 closes odoo#94281 X-original-commit: 849a561 Signed-off-by: William Henrotin (whe) <[email protected]>
1 parent 4c855bd commit 230f164

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

addons/purchase_stock/models/purchase.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -604,4 +604,4 @@ def _update_date_planned(self, updated_date):
604604
@api.model
605605
def _update_qty_received_method(self):
606606
"""Update qty_received_method for old PO before install this module."""
607-
self.search([])._compute_qty_received_method()
607+
self.search(['!', ('state', 'in', ['purchase', 'done'])])._compute_qty_received_method()

0 commit comments

Comments
 (0)