fix: Total amount not displayed in Journal Entry (#20794)

* fix: Total amount not displayed in Journal Entry

* fix: Update paid_to_received field

* fix: set total amount

Co-authored-by: Nabin Hait <nabinhait@gmail.com>
diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py
index 4491f7a..2cbd40b 100644
--- a/erpnext/accounts/doctype/journal_entry/journal_entry.py
+++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py
@@ -457,8 +457,7 @@
 		for d in self.get('accounts'):
 			if d.party_type in ['Customer', 'Supplier'] and d.party:
 				if not pay_to_recd_from:
-					pay_to_recd_from = frappe.db.get_value(d.party_type, d.party,
-						"customer_name" if d.party_type=="Customer" else "supplier_name")
+					pay_to_recd_from = d.party
 
 				if pay_to_recd_from and pay_to_recd_from == d.party:
 					party_amount += (d.debit_in_account_currency or d.credit_in_account_currency)
@@ -469,7 +468,8 @@
 				bank_account_currency = d.account_currency
 
 		if pay_to_recd_from:
-			self.pay_to_recd_from = pay_to_recd_from
+			self.pay_to_recd_from = frappe.db.get_value(d.party_type, pay_to_recd_from,
+				"customer_name" if d.party_type=="Customer" else "supplier_name")
 			if bank_amount:
 				total_amount = bank_amount
 				currency = bank_account_currency