summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryhu-odoo <yhu@odoo.com>2020-04-27 14:30:32 +0000
committeryhu-odoo <yhu@odoo.com>2020-05-27 07:41:43 +0000
commiteb6ddb6e9f7dea3a1251e59aca3f05488f661c70 (patch)
tree255f1841648c82a089a0f5fcb6f3134e8b5477cc
parent647247e3ff5c6dd287973cf88e4ffa4504bd77f0 (diff)
[FIX] purchase_stock: old PO not update qty_received after install purchase_stock
Before this commit, after install purchase_stock, old pol records won't update their qty_received when receive products. This is because their qty_received_method are not updated during the installation. Task 2230811 PR #49921
-rw-r--r--addons/purchase_stock/data/purchase_stock_data.xml2
-rw-r--r--addons/purchase_stock/models/purchase.py5
2 files changed, 7 insertions, 0 deletions
diff --git a/addons/purchase_stock/data/purchase_stock_data.xml b/addons/purchase_stock/data/purchase_stock_data.xml
index 431147a5b01..859d4cc1c63 100644
--- a/addons/purchase_stock/data/purchase_stock_data.xml
+++ b/addons/purchase_stock/data/purchase_stock_data.xml
@@ -2,6 +2,8 @@
<odoo>
<data noupdate="1">
+ <function model="purchase.order.line" name="_update_qty_received_method" />
+
<!--
Stock rules and routes
-->
diff --git a/addons/purchase_stock/models/purchase.py b/addons/purchase_stock/models/purchase.py
index 2651107d036..bfff1567238 100644
--- a/addons/purchase_stock/models/purchase.py
+++ b/addons/purchase_stock/models/purchase.py
@@ -510,3 +510,8 @@ class PurchaseOrderLine(models.Model):
incoming_moves |= move
return outgoing_moves, incoming_moves
+
+ @api.model
+ def _update_qty_received_method(self):
+ """Update qty_received_method for old PO before install this module."""
+ self.search([])._compute_qty_received_method()