From 3514332cd8f52dca1e4db8cd2ecd22c18712cd4b Mon Sep 17 00:00:00 2001 From: tunde Date: Wed, 14 Jun 2017 11:59:43 +0100 Subject: [PATCH] changes `journal_entry.get_exchange_rate` to return exchange rate at date not average exchange rate --- erpnext/accounts/doctype/journal_entry/journal_entry.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py index 34d9de7064..d5a1d62752 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py @@ -871,14 +871,9 @@ def get_exchange_rate(posting_date, account=None, account_currency=None, company if reference_type in ("Sales Invoice", "Purchase Invoice") and reference_name: exchange_rate = frappe.db.get_value(reference_type, reference_name, "conversion_rate") - elif account_details and account_details.account_type == "Bank" and \ - ((account_details.root_type == "Asset" and flt(credit) > 0) or - (account_details.root_type == "Liability" and debit)): - exchange_rate = get_average_exchange_rate(account) - # The date used to retreive the exchange rate here is the date passed # in as an argument to this function. - if not exchange_rate and account_currency and posting_date: + elif account_currency and posting_date: exchange_rate = get_exchange_rate(account_currency, company_currency, posting_date) else: exchange_rate = 1