From cabd6a8d8a58348e32048ace420a7a32c9f183fa Mon Sep 17 00:00:00 2001 From: venkat102 Date: Sat, 8 Feb 2025 23:09:29 +0530 Subject: [PATCH] fix(auto email report): add get_data function to multiselectlist filters --- .../auto_email_report/auto_email_report.js | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/frappe/email/doctype/auto_email_report/auto_email_report.js b/frappe/email/doctype/auto_email_report/auto_email_report.js index 991f83bbd5..6f729eafba 100644 --- a/frappe/email/doctype/auto_email_report/auto_email_report.js +++ b/frappe/email/doctype/auto_email_report/auto_email_report.js @@ -101,7 +101,7 @@ frappe.ui.form.on("Auto Email Report", { ); var filters = {}; - + var dialog; let report_filters; if ( @@ -136,6 +136,21 @@ frappe.ui.form.on("Auto Email Report", { $.each(report_filters, function (key, val) { // Remove break fieldtype from the filters if (val.fieldtype != "Break") { + if (val.fieldtype === "MultiSelectList") { + val.get_data = (txt) => { + if (!dialog || !val.options) return; + + let doctype_link = Array.isArray(val.options) + ? val.options + : frappe.scrub(val.options) === val.options + ? dialog.get_value(val.options) + : val.options; + + return doctype_link + ? frappe.db.get_link_options(doctype_link, txt) + : []; + }; + } report_filters_list.push(val); } }); @@ -156,7 +171,7 @@ frappe.ui.form.on("Auto Email Report", { }); table.on("click", function () { - var dialog = new frappe.ui.Dialog({ + dialog = new frappe.ui.Dialog({ fields: report_filters, primary_action: function () { var values = this.get_values();