From 74063026c811fef6a96f49a7a7616fd280afc447 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Mon, 28 Jul 2025 12:12:34 +0530 Subject: [PATCH] fix: get latest exchange rate (cherry picked from commit 5bfcaf48097e5b097a76bc4056b4d2f7e2efecc2) --- crm/fcrm/doctype/crm_deal/crm_deal.py | 2 +- crm/fcrm/doctype/crm_organization/crm_organization.py | 2 +- crm/utils/__init__.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crm/fcrm/doctype/crm_deal/crm_deal.py b/crm/fcrm/doctype/crm_deal/crm_deal.py index bd4198a3..4b9bc95d 100644 --- a/crm/fcrm/doctype/crm_deal/crm_deal.py +++ b/crm/fcrm/doctype/crm_deal/crm_deal.py @@ -177,7 +177,7 @@ class CRMDeal(Document): system_currency = frappe.db.get_single_value("FCRM Settings", "currency") or "USD" exchange_rate = 1 if self.currency and self.currency != system_currency: - exchange_rate = get_exchange_rate(self.currency, system_currency, frappe.utils.nowdate()) + exchange_rate = get_exchange_rate(self.currency, system_currency) self.db_set("exchange_rate", exchange_rate) diff --git a/crm/fcrm/doctype/crm_organization/crm_organization.py b/crm/fcrm/doctype/crm_organization/crm_organization.py index 1cdf186c..e528435c 100644 --- a/crm/fcrm/doctype/crm_organization/crm_organization.py +++ b/crm/fcrm/doctype/crm_organization/crm_organization.py @@ -16,7 +16,7 @@ class CRMOrganization(Document): system_currency = frappe.db.get_single_value("FCRM Settings", "currency") or "USD" exchange_rate = 1 if self.currency and self.currency != system_currency: - exchange_rate = get_exchange_rate(self.currency, system_currency, frappe.utils.nowdate()) + exchange_rate = get_exchange_rate(self.currency, system_currency) self.db_set("exchange_rate", exchange_rate) diff --git a/crm/utils/__init__.py b/crm/utils/__init__.py index eaf076d5..0e4582df 100644 --- a/crm/utils/__init__.py +++ b/crm/utils/__init__.py @@ -284,7 +284,7 @@ def get_exchange_rate(from_currency, to_currency, date=None): return rate frappe.log_error( - f"Failed to fetch exchange rate from {from_currency} to {to_currency} on {date}", title="Exchange Rate Fetch Error", + message=f"Failed to fetch exchange rate from {from_currency} to {to_currency} on {date}", ) return 1.0 # Default exchange rate if API call fails or no rate found