[FIX] Compute should work when to_currency is not supplied

bzr revid: jvo@tinyerp.com-20100707121723-17fum9ubsr2470gq
This commit is contained in:
Jay (Open ERP)
2010-07-07 17:47:23 +05:30
parent 97506ec8be
commit 941cb819cd
+3 -1
View File
@@ -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: