From 43cc7e4a59c3a84fc748110c06cdfb3bab4721e8 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Wed, 3 Jan 2024 17:59:15 +0530 Subject: [PATCH] fix: typerror on multi select dialog (cherry picked from commit 7da9ffa3bd072fbfc9627e6eb5afb3dd3078f560) --- erpnext/public/js/utils.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js index 35c3828d5b99..682762678ba1 100755 --- a/erpnext/public/js/utils.js +++ b/erpnext/public/js/utils.js @@ -759,16 +759,20 @@ erpnext.utils.map_current_doc = function(opts) { } if (opts.source_doctype) { + let data_fields = []; + if(opts.source_doctype == "Purchase Receipt") { + data_fields.push({ + fieldname: 'merge_taxes', + fieldtype: 'Check', + label: __('Merge taxes from multiple documents'), + }); + } const d = new frappe.ui.form.MultiSelectDialog({ doctype: opts.source_doctype, target: opts.target, date_field: opts.date_field || undefined, setters: opts.setters, - data_fields: [{ - fieldname: 'merge_taxes', - fieldtype: 'Check', - label: __('Merge taxes from multiple documents'), - }], + data_fields: data_fields, get_query: opts.get_query, add_filters_group: 1, allow_child_item_selection: opts.allow_child_item_selection, @@ -782,7 +786,10 @@ erpnext.utils.map_current_doc = function(opts) { return; } opts.source_name = values; - opts.args = args; + if (opts.allow_child_item_selection || opts.source_doctype == "Purchase Receipt") { + // args contains filtered child docnames + opts.args = args; + } d.dialog.hide(); _map(); },