diff --git a/bin/addons/base/res/res_currency.py b/bin/addons/base/res/res_currency.py index d4a82c6b9a5..3c59527d5f9 100644 --- a/bin/addons/base/res/res_currency.py +++ b/bin/addons/base/res/res_currency.py @@ -67,14 +67,17 @@ class res_currency(osv.osv): def round(self, cr, uid, currency, amount): return round(amount / currency.rounding) * currency.rounding - def compute(self, cr, uid, from_currency_id, to_currency_id, from_amount): + def compute(self, cr, uid, from_currency_id, to_currency_id, from_amount, round=True): if to_currency_id==from_currency_id: return from_amount - [from_currency]=self.read(cr, uid, [from_currency_id]) - [to_currency] = self.read(cr, uid, [to_currency_id]) + from_currency=self.browse(cr, uid, [from_currency_id])[0] + to_currency = self.browse(cr, uid, [to_currency_id])[0] if from_currency['rate'] == 0 or to_currency['rate'] == 0: raise osv.except_osv('Error', 'No rate found for the currency') - return self.round(cr, uid, to_currency, from_amount * from_currency['rate']/to_currency['rate']) + if round: + return self.round(cr, uid, to_currency, from_amount * from_currency.rate/to_currency.rate) + else: + return (from_amount * from_currency.rate/to_currency.rate) res_currency() class res_currency_rate(osv.osv):