summaryrefslogtreecommitdiff
path: root/addons/purchase
diff options
context:
space:
mode:
authorAchraf (abz) <abz@odoo.com>2021-04-13 06:46:58 +0000
committerAchraf (abz) <abz@odoo.com>2021-04-13 13:11:47 +0000
commitd531e8a5e4d84fe6daa9110d076b0fc601a0b4d9 (patch)
treebdc09451fcb4a73fdc6a719b77c4189bb4f40eb0 /addons/purchase
parente5880130c1534217c5bae905af8e5a040f40a819 (diff)
[FIX] purchase: Update correctly the price according to UoM
What are the steps to reproduce your issue ? 1. Create Product with Purchase Vendor(s) set 2. Create Units of Measure that are bigger than (10kg/50kg in tests) What is currently happening ? If you put a vendor that is listed in product form, when changing purchase unit from kg to 10/50kg price is updated If you put a vendor not listed, it gives cost price which is correct, but does not update price according to unit of measure. What are you expecting to happen ? Update correctly the unit of measure when the vendor is not listed opw-2494769 closes odoo/odoo#69148 Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
Diffstat (limited to 'addons/purchase')
-rw-r--r--addons/purchase/models/purchase.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/addons/purchase/models/purchase.py b/addons/purchase/models/purchase.py
index e28ff9e4243..56793330d20 100644
--- a/addons/purchase/models/purchase.py
+++ b/addons/purchase/models/purchase.py
@@ -1058,6 +1058,10 @@ class PurchaseOrderLine(models.Model):
self.order_id.company_id,
self.date_order or fields.Date.today(),
)
+
+ if self.product_uom:
+ price_unit = self.product_id.uom_id._compute_price(price_unit, self.product_uom)
+
self.price_unit = price_unit
return