diff --git a/lending/public/js/loan_common.js b/lending/public/js/loan_common.js index c23a413e..f1363bac 100644 --- a/lending/public/js/loan_common.js +++ b/lending/public/js/loan_common.js @@ -21,6 +21,22 @@ lending.common = { }, __("View")); } erpnext.hide_company(); + frm.trigger("set_company_filter"); + }, + + set_company_filter: function(frm) { + if ( + ["Loan Application", "Loan"].includes(frm.doc.doctype) && + frm.doc.applicant_type === "Employee" + ) { + frm.set_query("applicant", function() { + return { + "filters": { + "company": frm.doc.company + } + }; + }); + } }, applicant: function(frm) {