From a15b0108682f3892aebfbf6d562776a3fa763368 Mon Sep 17 00:00:00 2001 From: diptanilsaha Date: Thu, 11 Dec 2025 14:59:05 +0530 Subject: [PATCH] fix(currency exchange settings): added backward compatibility for frankfurter api (cherry picked from commit 5c2bb66028f40ab4177ff17986fc87b5300fefd7) # Conflicts: # erpnext/patches.txt --- .../currency_exchange_settings.js | 2 +- .../currency_exchange_settings.py | 6 ++-- erpnext/patches.txt | 36 +++++++++++++++++++ ...rency_exchange_settings_for_frankfurter.py | 7 +++- 4 files changed, 47 insertions(+), 4 deletions(-) diff --git a/erpnext/accounts/doctype/currency_exchange_settings/currency_exchange_settings.js b/erpnext/accounts/doctype/currency_exchange_settings/currency_exchange_settings.js index c3531420ce1..40f0938ee1c 100644 --- a/erpnext/accounts/doctype/currency_exchange_settings/currency_exchange_settings.js +++ b/erpnext/accounts/doctype/currency_exchange_settings/currency_exchange_settings.js @@ -19,7 +19,7 @@ frappe.ui.form.on("Currency Exchange Settings", { to: "{to_currency}", }; add_param(frm, r.message, params, result); - } else if (frm.doc.service_provider == "frankfurter.dev") { + } else if (["frankfurter.app", "frankfurter.dev"].includes(frm.doc.service_provider)) { let result = ["rates", "{to_currency}"]; let params = { base: "{from_currency}", diff --git a/erpnext/accounts/doctype/currency_exchange_settings/currency_exchange_settings.py b/erpnext/accounts/doctype/currency_exchange_settings/currency_exchange_settings.py index b36952ab4ff..d10c2947f2d 100644 --- a/erpnext/accounts/doctype/currency_exchange_settings/currency_exchange_settings.py +++ b/erpnext/accounts/doctype/currency_exchange_settings/currency_exchange_settings.py @@ -35,7 +35,7 @@ class CurrencyExchangeSettings(Document): self.append("req_params", {"key": "date", "value": "{transaction_date}"}) self.append("req_params", {"key": "from", "value": "{from_currency}"}) self.append("req_params", {"key": "to", "value": "{to_currency}"}) - elif self.service_provider == "frankfurter.dev": + elif self.service_provider in ("frankfurter.dev", "frankfurter.app"): self.set("result_key", []) self.set("req_params", []) @@ -80,9 +80,11 @@ class CurrencyExchangeSettings(Document): @frappe.whitelist() def get_api_endpoint(service_provider: str | None = None, use_http: bool = False): - if service_provider and service_provider in ["exchangerate.host", "frankfurter.dev"]: + if service_provider and service_provider in ["exchangerate.host", "frankfurter.dev", "frankfurter.app"]: if service_provider == "exchangerate.host": api = "api.exchangerate.host/convert" + elif service_provider == "frankfurter.app": + api = "api.frankfurter.app/{transaction_date}" elif service_provider == "frankfurter.dev": api = "api.frankfurter.dev/v1/{transaction_date}" diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 484133b7b25..4a08af08f29 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -377,4 +377,40 @@ execute:frappe.db.set_single_value("Accounts Settings", "receivable_payable_fetc erpnext.patches.v14_0.set_update_price_list_based_on erpnext.patches.v14_0.rename_group_by_to_categorize_by_in_custom_reports erpnext.patches.v14_0.update_full_name_in_contract +<<<<<<< HEAD erpnext.patches.v16_0.update_currency_exchange_settings_for_frankfurter +======= +erpnext.patches.v15_0.drop_sle_indexes #2025-09-18 +erpnext.patches.v15_0.update_pick_list_fields +execute:frappe.db.set_single_value("Accounts Settings", "confirm_before_resetting_posting_date", 1) +erpnext.patches.v15_0.rename_pos_closing_entry_fields #2025-06-13 +erpnext.patches.v15_0.update_pegged_currencies +erpnext.patches.v15_0.set_status_cancelled_on_cancelled_pos_opening_entry_and_pos_closing_entry +erpnext.patches.v15_0.set_company_on_pos_inv_merge_log +erpnext.patches.v15_0.update_payment_ledger_entries_against_advance_doctypes +erpnext.patches.v15_0.rename_price_list_to_buying_price_list +erpnext.patches.v15_0.repost_gl_entries_with_no_account_subcontracting #2025-08-04 +erpnext.patches.v15_0.patch_missing_buying_price_list_in_material_request +erpnext.patches.v15_0.remove_sales_partner_from_consolidated_sales_invoice +erpnext.patches.v15_0.update_uae_zero_rated_fetch +erpnext.patches.v15_0.add_company_payment_gateway_account +erpnext.patches.v16_0.set_invoice_type_in_pos_settings +erpnext.patches.v15_0.update_fieldname_in_accounting_dimension_filter +erpnext.patches.v16_0.make_workstation_operating_components #1 +erpnext.patches.v16_0.set_reporting_currency +erpnext.patches.v16_0.set_posting_datetime_for_sabb_and_drop_indexes +erpnext.patches.v16_0.update_serial_no_reference_name +erpnext.patches.v16_0.update_account_categories_for_existing_accounts +erpnext.patches.v16_0.rename_subcontracted_quantity +erpnext.patches.v16_0.add_new_stock_entry_types +erpnext.patches.v15_0.set_asset_status_if_not_already_set +erpnext.patches.v15_0.toggle_legacy_controller_for_period_closing +erpnext.patches.v16_0.update_serial_batch_entries +erpnext.patches.v16_0.set_company_wise_warehouses +erpnext.patches.v16_0.set_valuation_method_on_companies +erpnext.patches.v15_0.migrate_old_item_wise_tax_detail_data_to_table +erpnext.patches.v16_0.migrate_budget_records_to_new_structure +erpnext.patches.v16_0.update_currency_exchange_settings_for_frankfurter #2025-12-11 +erpnext.patches.v16_0.migrate_account_freezing_settings_to_company +erpnext.patches.v16_0.populate_budget_distribution_total +>>>>>>> 5c2bb66028 (fix(currency exchange settings): added backward compatibility for frankfurter api) diff --git a/erpnext/patches/v16_0/update_currency_exchange_settings_for_frankfurter.py b/erpnext/patches/v16_0/update_currency_exchange_settings_for_frankfurter.py index 68157b1a4ad..9d3f78cc09b 100644 --- a/erpnext/patches/v16_0/update_currency_exchange_settings_for_frankfurter.py +++ b/erpnext/patches/v16_0/update_currency_exchange_settings_for_frankfurter.py @@ -2,8 +2,13 @@ import frappe def execute(): + settings_meta = frappe.get_meta("Currency Exchange Settings") settings = frappe.get_doc("Currency Exchange Settings") - if settings.service_provider != "frankfurter.app": + + if ( + "frankfurter.dev" not in settings_meta.get_options("service_provider").split("\n") + or settings.service_provider != "frankfurter.app" + ): return settings.service_provider = "frankfurter.dev"