Amit Dodiya (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-server/6.0-opw-18123-Lorenzo_Battistini into 
lp:openobject-server/6.0.

Requested reviews:
  Raphael Collet (OpenERP) (rco-openerp)
Related bugs:
  Bug #865387 in OpenERP Addons: "wrong currency rounding"
  https://bugs.launchpad.net/openobject-addons/+bug/865387

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-server/6.0-opw-18123-Lorenzo_Battistini/+merge/79087

Hello,

[FIX]:wrong currency rounding : case(18123)

thanks,
Amit
-- 
https://code.launchpad.net/~openerp-dev/openobject-server/6.0-opw-18123-Lorenzo_Battistini/+merge/79087
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-server/6.0-opw-18123-Lorenzo_Battistini.
=== modified file 'bin/addons/base/res/res_currency.py'
--- bin/addons/base/res/res_currency.py	2011-07-13 15:32:10 +0000
+++ bin/addons/base/res/res_currency.py	2011-10-12 09:34:36 +0000
@@ -22,6 +22,7 @@
 import netsvc
 from osv import fields, osv
 import ir
+from decimal import *
 
 from tools.misc import currency
 from tools.translate import _
@@ -84,7 +85,7 @@
         else:
             # /!\ 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
+            return float(Decimal(str(amount)).quantize(Decimal(str(currency.rounding)), rounding=ROUND_HALF_UP))
 
     def is_zero(self, cr, uid, currency, amount):
         return abs(self.round(cr, uid, currency, amount)) < currency.rounding

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to