← Back to team overview

openerp-expert-accounting team mailing list archive

Currency rounding issues

 

Can somebody explain the reason for this commit?

http://bazaar.launchpad.net/~openerp/openobject-server/5.0/revision/1915

Taking a look at latest three changes to res_currency.py makes one think... 
also, clearer commit messages may also help?

-- 
Albert Cervera i Areny
http://www.NaN-tic.com
Mòbil: +34 669 40 40 18
------------------------------------------------------------
revno: 1915
author: VRA(OpenERP)
committer: Jay(Open ERP)<jvo@xxxxxxxxxxx>
branch nick: 5.0
timestamp: Mon 2009-12-21 17:01:16 +0530
message:
  [FIX] Currency : Rounding improved
diff:
=== modified file 'bin/addons/base/res/res_currency.py'
--- bin/addons/base/res/res_currency.py	2009-11-12 07:56:40 +0000
+++ bin/addons/base/res/res_currency.py	2009-12-21 11:31:16 +0000
@@ -67,7 +67,7 @@
         if currency.rounding == 0:
             return 0.0
         else:
-            return round(amount / currency.rounding) * currency.rounding
+            return round(amount / currency.rounding,6) * currency.rounding
 
     def is_zero(self, cr, uid, currency, amount):
         return abs(self.round(cr, uid, currency, amount)) < currency.rounding
------------------------------------------------------------
revno: 1867
committer: Fabien Pinckaers <fp@xxxxxxxxxxx>
branch nick: server
timestamp: Sun 2009-11-01 08:28:28 +0100
message:
  merge
diff:
=== modified file 'bin/addons/base/res/res_currency.py'
--- bin/addons/base/res/res_currency.py	2009-09-18 13:55:56 +0000
+++ bin/addons/base/res/res_currency.py	2009-11-01 07:28:28 +0000
@@ -26,7 +26,6 @@
 
 from tools.misc import currency
 from tools.translate import _
-from tools import config
 
 import mx.DateTime
 from mx.DateTime import RelativeDateTime, now, DateTime, localtime
@@ -68,7 +67,7 @@
         if currency.rounding == 0:
             return 0.0
         else:
-            return round(amount / currency.rounding, int(config['price_accuracy'])) * currency.rounding
+            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
------------------------------------------------------------
revno: 1853
committer: Jay(Open ERP)<jvo@xxxxxxxxxxx>
branch nick: 5.0
timestamp: Fri 2009-09-18 19:25:56 +0530
message:
  [FIX] Price Accuracy : rounding made to be based on --price_accuracy option
diff:
=== modified file 'bin/addons/base/res/res_currency.py'
--- bin/addons/base/res/res_currency.py	2009-01-26 17:40:29 +0000
+++ bin/addons/base/res/res_currency.py	2009-09-18 13:55:56 +0000
@@ -26,6 +26,7 @@
 
 from tools.misc import currency
 from tools.translate import _
+from tools import config
 
 import mx.DateTime
 from mx.DateTime import RelativeDateTime, now, DateTime, localtime
@@ -67,7 +68,7 @@
         if currency.rounding == 0:
             return 0.0
         else:
-            return round(amount / currency.rounding) * currency.rounding
+            return round(amount / currency.rounding, int(config['price_accuracy'])) * currency.rounding
 
     def is_zero(self, cr, uid, currency, amount):
         return abs(self.round(cr, uid, currency, amount)) < currency.rounding

Follow ups