fix DivideByZero

bzr revid: stephane@tinyerp.com-20080922101605-lsof52sp7b6gi60f
This commit is contained in:
Stephane Wirtel 2008-09-22 12:16:05 +02:00
parent 939fd61f1a
commit 9cdba9adce
1 changed files with 4 additions and 1 deletions

View File

@ -71,7 +71,10 @@ class res_currency(osv.osv):
_order = "code"
def round(self, cr, uid, currency, amount):
return round(amount / currency.rounding) * currency.rounding
if currency.rounding == 0:
return 0.0
else:
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