From 9cdba9adce3aece0c903f539bc6e113a4903eaad Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Mon, 22 Sep 2008 12:16:05 +0200 Subject: [PATCH] fix DivideByZero bzr revid: stephane@tinyerp.com-20080922101605-lsof52sp7b6gi60f --- bin/addons/base/res/res_currency.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bin/addons/base/res/res_currency.py b/bin/addons/base/res/res_currency.py index 05541689154..55de9ecc380 100644 --- a/bin/addons/base/res/res_currency.py +++ b/bin/addons/base/res/res_currency.py @@ -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