Use absolute quantity to compute price

issue3309
review986003
This commit is contained in:
Cédric Krier committed 2013-08-01 16:16:40 +02:00
1 parent 79373dc33a
commit 9f40c0238b
1 file changed
+2 -2
+2 -2
View File
@@ -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])