Improve currency rate error message
bzr revid: ced-f64b6ff72f5ee8016bda1fca05f895263ac4b6f6
This commit is contained in:
parent
f259e56778
commit
1af2fce548
|
@ -82,7 +82,14 @@ class res_currency(osv.osv):
|
|||
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:
|
||||
raise osv.except_osv('Error', 'No rate found for the currency')
|
||||
date = context.get('date', time.strftime('%Y-%m-%d'))
|
||||
if from_currency['rate'] == 0:
|
||||
code = from_currency.code
|
||||
else:
|
||||
code = to_currency.code
|
||||
raise osv.except_osv('Error', 'No rate found \n' \
|
||||
'for the currency: %s \n' \
|
||||
'at the date: %s' % (code, date))
|
||||
if to_currency_id==from_currency_id:
|
||||
if round:
|
||||
return self.round(cr, uid, to_currency, from_amount)
|
||||
|
|
Loading…
Reference in New Issue