summaryrefslogtreecommitdiff
path: root/addons/purchase_stock
diff options
context:
space:
mode:
authorWilliam Henrotin <whe@odoo.com>2020-10-08 09:32:37 +0000
committerWilliam Henrotin <whe@odoo.com>2020-10-08 11:13:43 +0000
commit3d592649970df3d755ccb57d68c074acdff67894 (patch)
tree4ead3f6ec0b82404720166e6117b042d2d0df3fa /addons/purchase_stock
parent5bc6eb9b387112138ac118726ff746bad6d00f8d (diff)
[FIX] purchase(_stock): track qty_received changes
Commit 0f80e69b8d260c0ed4bbbbad2d0c1e88ab054bf5 tracked all changes on qty_received on the purchase order. But did that wrongly by calling `write` inside a compute. Commit b7cc3b068f685d1339f9fe7e47d0c564de1708e7 fixed this `write` by an `=` to avoid error when the compute is called on virtual records. This fix result on forgetting to track the quantity delivered. This commit sends a message to post in `write` AND in the `compute_qty_received` to be sure it is posted. This way, we do not call write in compute anymore. closes odoo/odoo#59482 Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
Diffstat (limited to 'addons/purchase_stock')
-rw-r--r--addons/purchase_stock/models/purchase.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/addons/purchase_stock/models/purchase.py b/addons/purchase_stock/models/purchase.py
index 7e4a4df0a20..01971b20846 100644
--- a/addons/purchase_stock/models/purchase.py
+++ b/addons/purchase_stock/models/purchase.py
@@ -320,6 +320,7 @@ class PurchaseOrderLine(models.Model):
total -= move.product_uom._compute_quantity(move.product_uom_qty, line.product_uom)
else:
total += move.product_uom._compute_quantity(move.product_uom_qty, line.product_uom)
+ line._track_qty_received(total)
line.qty_received = total
@api.model_create_multi