From 1af2fce548ff809bb4b93c001d62912c3b28d0fd Mon Sep 17 00:00:00 2001 From: ced <> Date: Wed, 31 Oct 2007 14:14:10 +0000 Subject: [PATCH] Improve currency rate error message bzr revid: ced-f64b6ff72f5ee8016bda1fca05f895263ac4b6f6 --- bin/addons/base/res/res_currency.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bin/addons/base/res/res_currency.py b/bin/addons/base/res/res_currency.py index 41b8de2f75e..5c9911022eb 100644 --- a/bin/addons/base/res/res_currency.py +++ b/bin/addons/base/res/res_currency.py @@ -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)