Reviewers: ,


Please review this at http://codereview.tryton.org/129002/

Affected files:
  M purchase.py


Index: purchase.py
===================================================================
--- a/purchase.py
+++ b/purchase.py
@@ -1090,6 +1090,8 @@
         with Transaction().set_context(context2):
res['unit_price'] = product_obj.get_purchase_price([product.id],
                     vals.get('quantity', 0))[product.id]
+            res['unit_price'] = res['unit_price'].quantize(
+                Decimal('1.' + '0' * self.unit_price.digits[1]))
         res['taxes'] = []
         pattern = self._get_tax_rule_pattern(party, vals)
         for tax in product.supplier_taxes_used:
@@ -1145,6 +1147,8 @@
             res['unit_price'] = product_obj.get_purchase_price(
                     [vals['product']], vals.get('quantity', 0)
                     )[vals['product']]
+            res['unit_price'] = res['unit_price'].quantize(
+                Decimal('1.' + '0' * self.unit_price.digits[1]))
         return res

     def on_change_unit(self, vals):
@@ -1517,7 +1521,7 @@
                     with Transaction().set_context(date=date):
                         res[product.id] = currency_obj.compute(
                             user.company.currency.id, res[product.id],
-                            currency.id)
+                            currency.id, round=False)
         return res

 Product()


--
[email protected] mailing list

Reply via email to