From 9f40c0238bb2dedc5703692005d03bfe12f42042 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 1 Aug 2013 16:16:40 +0200 Subject: [PATCH] Use absolute quantity to compute price issue3309 review986003 --- purchase.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/purchase.py b/purchase.py index 307f3164ad..826e8e308c 100644 --- a/purchase.py +++ b/purchase.py @@ -1016,7 +1016,7 @@ class PurchaseLine(ModelSQL, ModelView): with Transaction().set_context(self._get_context_purchase_price()): res['unit_price'] = Product.get_purchase_price([self.product], - self.quantity or 0)[self.product.id] + abs(self.quantity or 0))[self.product.id] if res['unit_price']: res['unit_price'] = res['unit_price'].quantize( Decimal(1) / 10 ** self.__class__.unit_price.digits[1]) @@ -1056,7 +1056,7 @@ class PurchaseLine(ModelSQL, ModelView): with Transaction().set_context(self._get_context_purchase_price()): res['unit_price'] = Product.get_purchase_price([self.product], - self.quantity or 0)[self.product.id] + abs(self.quantity or 0))[self.product.id] if res['unit_price']: res['unit_price'] = res['unit_price'].quantize( Decimal(1) / 10 ** self.__class__.unit_price.digits[1])