[fix] [exchange-rate] let user defined exchange rate take preceedence
This commit is contained in:
parent
746fd90625
commit
9f436a7c71
@ -71,6 +71,9 @@ def get_exchange_rate(from_currency, to_currency):
|
|||||||
cache = frappe.cache()
|
cache = frappe.cache()
|
||||||
key = "currency_exchange_rate:{0}:{1}".format(from_currency, to_currency)
|
key = "currency_exchange_rate:{0}:{1}".format(from_currency, to_currency)
|
||||||
value = cache.get(key)
|
value = cache.get(key)
|
||||||
|
|
||||||
|
print value
|
||||||
|
|
||||||
if not value:
|
if not value:
|
||||||
import requests
|
import requests
|
||||||
response = requests.get("http://api.fixer.io/latest", params={
|
response = requests.get("http://api.fixer.io/latest", params={
|
||||||
@ -86,4 +89,4 @@ def get_exchange_rate(from_currency, to_currency):
|
|||||||
frappe.msgprint(_("Unable to find exchange rate"))
|
frappe.msgprint(_("Unable to find exchange rate"))
|
||||||
return 0.0
|
return 0.0
|
||||||
else:
|
else:
|
||||||
return 0.0
|
return value
|
||||||
|
Loading…
x
Reference in New Issue
Block a user