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

(cherry picked from commit 6681882bd8)
This commit is contained in:
ruthra kumar
2024-11-18 16:25:44 +05:30
committed by Mergify
parent 7cc31df587
commit d7deed6c45

View File

@@ -1146,6 +1146,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)