Improved currency exchange rate message

This commit is contained in:
Nabin Hait 2017-05-24 16:18:27 +05:30
parent cf1e0508af
commit 7a9bd41a72

View File

@ -91,8 +91,7 @@ def get_exchange_rate(from_currency, to_currency, transaction_date=None):
response.raise_for_status() response.raise_for_status()
value = response.json()["rates"][to_currency] value = response.json()["rates"][to_currency]
cache.setex(key, value, 6 * 60 * 60) cache.setex(key, value, 6 * 60 * 60)
return flt(value) return flt(value)
except: except:
frappe.msgprint(_("Unable to find exchange rate for {0} to {1} for key date {2}").format(from_currency, to_currency, transaction_date)) frappe.msgprint(_("Unable to find exchange rate for {0} to {1} for key date {2}. Please create a Currency Exchange record manually").format(from_currency, to_currency, transaction_date))
return 0.0 return 0.0