diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.js b/erpnext/accounts/doctype/payment_entry/payment_entry.js index f2d11ba9ff3c..8fd5f00b5836 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.js +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.js @@ -1328,6 +1328,24 @@ frappe.ui.form.on("Payment Entry", { if (r.message) { if (!frm.doc.mode_of_payment) { frm.set_value(field, r.message.account); + } else { + frappe.call({ + method: "frappe.client.get_value", + args: { + doctype: "Mode of Payment Account", + filters: { + parent: frm.doc.mode_of_payment, + company: frm.doc.company, + }, + fieldname: "default_account", + parent: "Mode of Payment", + }, + callback: function (res) { + if (!res.message.default_account) { + frm.set_value(field, r.message.account); + } + }, + }); } frm.set_value("bank", r.message.bank); frm.set_value("bank_account_no", r.message.bank_account_no);