[FIX] res_currency: revert to correct rounding mechanism
authorOlivier Dony <odo@openerp.com>
Fri, 23 Apr 2010 13:17:44 +0000 (15:17 +0200)
committerOlivier Dony <odo@openerp.com>
Fri, 23 Apr 2010 13:17:44 +0000 (15:17 +0200)
lp bug: https://launchpad.net/bugs/513278 fixed
lp bug: https://launchpad.net/bugs/452854 fixed

bzr revid: odo@openerp.com-20100423131744-wx2fvl217v5d1rpe

bin/addons/base/res/res_currency.py

index d8f58b8..eece692 100644 (file)
@@ -67,7 +67,9 @@ class res_currency(osv.osv):
         if currency.rounding == 0:
             return 0.0
         else:
-            return round(amount / currency.rounding,6) * currency.rounding
+            # /!\ First member below must be rounded to full unit!
+            # Do not pass a rounding digits value to round()
+            return round(amount / currency.rounding) * currency.rounding
 
     def is_zero(self, cr, uid, currency, amount):
         return abs(self.round(cr, uid, currency, amount)) < currency.rounding