From 5a5a72aae0edc11efb073e374a53c17bd72b69bb Mon Sep 17 00:00:00 2001 From: Saqib Date: Fri, 17 Sep 2021 13:03:27 +0530 Subject: [PATCH] fix: unecessary keyword args were passed in mapper functions (#27563) (cherry picked from commit e03d9aa8890680baefe0d335dafdbfc5d0445fd4) --- erpnext/public/js/utils.js | 7 +++++-- erpnext/stock/doctype/material_request/material_request.py | 5 +++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js index ee8a516a1487..e1cef614a22c 100755 --- a/erpnext/public/js/utils.js +++ b/erpnext/public/js/utils.js @@ -714,12 +714,15 @@ erpnext.utils.map_current_doc = function(opts) { child_columns: opts.child_columns, action: function(selections, args) { let values = selections; - if(values.length === 0){ + if (values.length === 0) { frappe.msgprint(__("Please select {0}", [opts.source_doctype])) return; } opts.source_name = values; - opts.args = args; + if (opts.allow_child_item_selection) { + // args contains filtered child docnames + opts.args = args; + } d.dialog.hide(); _map(); }, diff --git a/erpnext/stock/doctype/material_request/material_request.py b/erpnext/stock/doctype/material_request/material_request.py index 2569c04251c7..cf98b19e7a11 100644 --- a/erpnext/stock/doctype/material_request/material_request.py +++ b/erpnext/stock/doctype/material_request/material_request.py @@ -272,8 +272,9 @@ def update_status(name, status): material_request.update_status(status) @frappe.whitelist() -def make_purchase_order(source_name, target_doc=None, args={}): - +def make_purchase_order(source_name, target_doc=None, args=None): + if args is None: + args = {} if isinstance(args, string_types): args = json.loads(args)