mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-21 11:15:10 +00:00
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:
|
if not transaction_date:
|
||||||
transaction_date = nowdate()
|
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()
|
currency_settings = frappe.get_doc("Accounts Settings").as_dict()
|
||||||
allow_stale_rates = currency_settings.get("allow_stale")
|
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"):
|
if frappe.get_cached_value("Currency Exchange Settings", "Currency Exchange Settings", "disabled"):
|
||||||
return 0.00
|
return 0.00
|
||||||
|
|
||||||
|
if rate := get_pegged_rate(from_currency, to_currency, transaction_date):
|
||||||
|
return rate
|
||||||
|
|
||||||
try:
|
try:
|
||||||
cache = frappe.cache()
|
cache = frappe.cache()
|
||||||
key = f"currency_exchange_rate_{transaction_date}:{from_currency}:{to_currency}"
|
key = f"currency_exchange_rate_{transaction_date}:{from_currency}:{to_currency}"
|
||||||
|
|||||||
Reference in New Issue
Block a user