From 1a9ddfa8f21555e09eab5a1c8a5c2f4e1eebeba7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 2 Apr 2017 12:49:47 +0200 Subject: [PATCH] Do not convert price if context uom is from different category issue6407 review39291002 --- product.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/product.py b/product.py index 6545403a05..3976e21169 100644 --- a/product.py +++ b/product.py @@ -303,12 +303,15 @@ class Product(ModelSQL, ModelView): field = name[:-4] if Transaction().context.get('uom'): to_uom = Uom(Transaction().context['uom']) - for product in products: - res[product.id] = Uom.compute_price( - product.default_uom, getattr(product, field), to_uom) else: - for product in products: - res[product.id] = getattr(product, field) + to_uom = None + for product in products: + price = getattr(product, field) + if to_uom and product.default_uom.category == to_uom.category: + res[product.id] = Uom.compute_price( + product.default_uom, price, to_uom) + else: + res[product.id] = price return res @classmethod