[API] erpnext.setup.utils.get_exchange_rate : Unable to find exchange rate

method: “erpnext.setup.utils.get_exchange_rate”,
args: {
from_currency: “USD”,
to_currency: “MMK”
callback: function(r) {

All CURRENCY AND PRICE LIST not working in any form.
But python works normally

filters = [
[“date”, “<=”, get_datetime_str(nowdate())],
[“from_currency”, “=”, “USD”],
[“to_currency”, “=”, “MMK”]

entries = frappe.get_all(
“Currency Exchange”, fields=[“exchange_rate”], filters=filters, order_by=“date desc”,

ERPNext: v9.1.6 (master)
Frappe Framework: v9.1.8 (master)


What is the different between filters and filters1 below?

filters1 works. filters not work.

filters = [
[“from_currency”, “=”, “USD”],
[‘to_currency’, ‘=’, “MMK”]

filters1 = {‘to_currency’:‘MMK’,‘from_currency’:‘USD’}

entries = frappe.get_all(
“Currency Exchange”, fields=[“exchange_rate”], filters=filters1, order_by=“date desc”,limit=1)

You configuration is messing up the query.

Set Allow Stale Exchange Rates (or if your use case requires you to unset it then specify the Stale Days)

Stale Days must be more than one (>= 1) or check allow Stale Exchange Rates in the Accounts Settings Form.

I just copy this configuration from frappe core to test because it doesn’t work.

Are you sure that you have any record of the Currency Exchange?

100% sure

Can you kindly share your Account Settings?

Here’s my account setting.

Set Stale Days to 1 and try again.

1 Like

It works. Can you explain what Stale Days = 1 mean?


Stale Days: The number of days to use when deciding if a Currency Exchange record is stale. E.g If Currency Exchange records are to be updated every day, the Stale Days should be set as 1.

For more info, please, visit this docs:
Account Settings

1 Like