[Minor] Added condition for get_bank_cash_account (#15112)
diff --git a/erpnext/hr/doctype/employee_loan/employee_loan.js b/erpnext/hr/doctype/employee_loan/employee_loan.js
index 1f38105..e089e29 100644
--- a/erpnext/hr/doctype/employee_loan/employee_loan.js
+++ b/erpnext/hr/doctype/employee_loan/employee_loan.js
@@ -71,19 +71,22 @@
}
})
},
+
mode_of_payment: function (frm) {
- frappe.call({
- method: "erpnext.accounts.doctype.sales_invoice.sales_invoice.get_bank_cash_account",
- args: {
- "mode_of_payment": frm.doc.mode_of_payment,
- "company": frm.doc.company
- },
- callback: function (r, rt) {
- if (r.message) {
- frm.set_value("payment_account", r.message.account);
+ if (frm.doc.mode_of_payment && frm.doc.company) {
+ frappe.call({
+ method: "erpnext.accounts.doctype.sales_invoice.sales_invoice.get_bank_cash_account",
+ args: {
+ "mode_of_payment": frm.doc.mode_of_payment,
+ "company": frm.doc.company
+ },
+ callback: function (r, rt) {
+ if (r.message) {
+ frm.set_value("payment_account", r.message.account);
+ }
}
- }
- });
+ });
+ }
},
employee_loan_application: function (frm) {