From b263876918bd05a75acf7b73d154161abecc9453 Mon Sep 17 00:00:00 2001 From: bcornwellmott Date: Tue, 5 Mar 2019 16:44:02 -0800 Subject: [PATCH] Add date to currency exchange caching The current currency exchange caching does not keep track of the transaction date, so if you are backdating transactions, the system probably isn't pulling the correct exchange rate (if it's looking up the currency exchange rate on the fly) --- erpnext/setup/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/setup/utils.py b/erpnext/setup/utils.py index 01e0b7d441..d1c206d8b1 100644 --- a/erpnext/setup/utils.py +++ b/erpnext/setup/utils.py @@ -93,7 +93,7 @@ def get_exchange_rate(from_currency, to_currency, transaction_date=None, args=No try: cache = frappe.cache() - key = "currency_exchange_rate:{0}:{1}".format(from_currency, to_currency) + key = "currency_exchange_rate_{0}:{1}:{2}".format(transaction_date,from_currency, to_currency) value = cache.get(key) if not value: @@ -143,4 +143,4 @@ def insert_record(records): def welcome_email(): site_name = get_default_company() title = _("Welcome to {0}".format(site_name)) - return title \ No newline at end of file + return title