fix: use value from currency exchange when exchange api is disabled (#46137)
(cherry picked from commit 2d26bff870)
Co-authored-by: Venkatesh <47534423+venkat102@users.noreply.github.com>
This commit is contained in:
@@ -68,9 +68,6 @@ def get_exchange_rate(from_currency, to_currency, transaction_date=None, args=No
|
||||
if not transaction_date:
|
||||
transaction_date = nowdate()
|
||||
|
||||
if rate := get_pegged_rate(from_currency, to_currency, transaction_date):
|
||||
return rate
|
||||
|
||||
currency_settings = frappe.get_doc("Accounts Settings").as_dict()
|
||||
allow_stale_rates = currency_settings.get("allow_stale")
|
||||
|
||||
@@ -100,6 +97,9 @@ def get_exchange_rate(from_currency, to_currency, transaction_date=None, args=No
|
||||
if frappe.get_cached_value("Currency Exchange Settings", "Currency Exchange Settings", "disabled"):
|
||||
return 0.00
|
||||
|
||||
if rate := get_pegged_rate(from_currency, to_currency, transaction_date):
|
||||
return rate
|
||||
|
||||
try:
|
||||
cache = frappe.cache()
|
||||
key = f"currency_exchange_rate_{transaction_date}:{from_currency}:{to_currency}"
|
||||
|
||||
Reference in New Issue
Block a user