From 106d469c07a876bb702d18eb9c7096e36840d6a6 Mon Sep 17 00:00:00 2001 From: Rucha Mahabal Date: Fri, 12 Jan 2024 12:39:28 +0530 Subject: [PATCH] fix: apply company filter on employee applicant field --- lending/public/js/loan_common.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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) {