Skip to content

Commit

Permalink
fix: use value from currency exchange when exchange api is disabled (…
Browse files Browse the repository at this point in the history
…backport #46137) (#46309)

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

(cherry picked from commit 2d26bff)

Co-authored-by: Venkatesh <47534423+venkat102@users.noreply.github.com>
  • Loading branch information
mergify[bot] and venkat102 authored Mar 5, 2025
1 parent 1ff0858 commit ccc0358
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions erpnext/setup/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down Expand Up @@ -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}"
Expand Down

0 comments on commit ccc0358

Please sign in to comment.