[fix] In payment entry, run some events serially to avoid async issue
diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.js b/erpnext/accounts/doctype/payment_entry/payment_entry.js
index c5e0306..d8995a9 100644
--- a/erpnext/accounts/doctype/payment_entry/payment_entry.js
+++ b/erpnext/accounts/doctype/payment_entry/payment_entry.js
@@ -253,20 +253,24 @@
 				},
 				callback: function(r, rt) {
 					if(r.message) {
-						if(frm.doc.payment_type == "Receive") {
-							frm.set_value("paid_from", r.message.party_account);
-							frm.set_value("paid_from_account_currency", r.message.party_account_currency);
-							frm.set_value("paid_from_account_balance", r.message.account_balance);
-						} else if (frm.doc.payment_type == "Pay"){
-							frm.set_value("paid_to", r.message.party_account);
-							frm.set_value("paid_to_account_currency", r.message.party_account_currency);
-							frm.set_value("paid_to_account_balance", r.message.account_balance);
-						}
-						frm.set_value("party_balance", r.message.party_balance);
-						frm.events.get_outstanding_documents(frm);
-						frm.events.hide_unhide_fields(frm);
-						frm.events.set_dynamic_labels(frm);
-						frm.set_party_account_based_on_party = false;
+						frappe.run_serially([
+							() => {
+								if(frm.doc.payment_type == "Receive") {
+									frm.set_value("paid_from", r.message.party_account);
+									frm.set_value("paid_from_account_currency", r.message.party_account_currency);
+									frm.set_value("paid_from_account_balance", r.message.account_balance);
+								} else if (frm.doc.payment_type == "Pay"){
+									frm.set_value("paid_to", r.message.party_account);
+									frm.set_value("paid_to_account_currency", r.message.party_account_currency);
+									frm.set_value("paid_to_account_balance", r.message.account_balance);
+								}
+							},
+							() => frm.set_value("party_balance", r.message.party_balance),
+							() => frm.events.get_outstanding_documents(frm),
+							() => frm.events.hide_unhide_fields(frm),
+							() => frm.events.set_dynamic_labels(frm),
+							() => { frm.set_party_account_based_on_party = false; }
+						]);
 					}
 				}
 			});