fix: use value from currency exchange when exchange api is disabled (#46137)

This commit is contained in:
Venkatesh
2025-03-05 13:15:20 +05:30
committed by GitHub
parent 27446a68b7
commit 2d26bff870

View File

@@ -66,9 +66,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")
@@ -98,6 +95,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}"