From 6681882bd8003cac1d8d4eda76141ec5a6b6b246 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Mon, 18 Nov 2024 16:25:44 +0530 Subject: [PATCH] refactor: assume any of the foreign currency as transaction currency On a foreign currency payment entry, assume any one of the foreign currency as the transaction currency --- erpnext/accounts/doctype/payment_entry/payment_entry.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py index 7d3ff85d0c9..f2f63a523cc 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.py +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py @@ -1243,6 +1243,12 @@ class PaymentEntry(AccountsController): if self.payment_type in ("Receive", "Pay") and not self.get("party_account_field"): self.setup_party_account_field() + company_currency = erpnext.get_company_currency(self.company) + if self.paid_from_account_currency != company_currency: + self.currency = self.paid_from_account_currency + elif self.paid_to_account_currency != company_currency: + self.currency = self.paid_to_account_currency + gl_entries = [] self.add_party_gl_entries(gl_entries) self.add_bank_gl_entries(gl_entries)