From 48cfe4798ed3589e8ea7502d0d48b40adcaad95f Mon Sep 17 00:00:00 2001 From: Nihantra Patel Date: Thu, 8 Feb 2024 10:02:44 +0530 Subject: [PATCH] fix: remove company filter from customer and member in applicant field --- lending/public/js/loan_common.js | 33 ++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/lending/public/js/loan_common.js b/lending/public/js/loan_common.js index f1363bac..9487935a 100644 --- a/lending/public/js/loan_common.js +++ b/lending/public/js/loan_common.js @@ -23,19 +23,28 @@ lending.common = { erpnext.hide_company(); frm.trigger("set_company_filter"); }, - + applicant_type: function(frm) { + 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 - } - }; - }); + if (["Loan Application", "Loan"].includes(frm.doc.doctype)) { + if (frm.doc.applicant_type === "Employee") { + frm.set_query("applicant", function() { + return { + "filters": { + "company": frm.doc.company + } + }; + }); + } else { + frm.set_query("applicant", function() { + return { + "filters": { + "docstatus": 0 + } + }; + }); + } } },