From 941cb819cd49c5350ccca47d982d9f4fe103d08e Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Wed, 7 Jul 2010 17:47:23 +0530 Subject: [PATCH] [FIX] Compute should work when to_currency is not supplied bzr revid: jvo@tinyerp.com-20100707121723-17fum9ubsr2470gq --- bin/addons/base/res/res_currency.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/addons/base/res/res_currency.py b/bin/addons/base/res/res_currency.py index 86742dc14ae..0d03c067223 100644 --- a/bin/addons/base/res/res_currency.py +++ b/bin/addons/base/res/res_currency.py @@ -89,7 +89,9 @@ class res_currency(osv.osv): def compute(self, cr, uid, from_currency_id, to_currency_id, from_amount, round=True, context={}, account=None, account_invert=False): if not from_currency_id: from_currency_id = to_currency_id - xc=self.browse(cr, uid, [from_currency_id,to_currency_id], context=context) + if not to_currency_id: + to_currency_id = from_currency_id + xc = self.browse(cr, uid, [from_currency_id,to_currency_id], context=context) from_currency = (xc[0].id == from_currency_id and xc[0]) or xc[1] to_currency = (xc[0].id == to_currency_id and xc[0]) or xc[1] if from_currency['rate'] == 0 or to_currency['rate'] == 0: