From b6a3e693aedf87cb9e39a30937980bb99b3ba33d Mon Sep 17 00:00:00 2001 From: Ahmad Date: Mon, 2 May 2022 18:05:21 +0500 Subject: [PATCH] feat: request_for_quotation - refactor - Set supplier as link in while selecting supplier to create quotation (cherry picked from commit 04c96b547e7775bfb1d50416e6e84f926e784995) --- .../request_for_quotation.js | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js index 9725878f81b..17b45b29707 100644 --- a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js +++ b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.js @@ -92,17 +92,19 @@ frappe.ui.form.on("Request for Quotation",{ var dialog = new frappe.ui.Dialog({ title: __("Create Supplier Quotation"), fields: [ - { "fieldtype": "Select", "label": __("Supplier"), + { "fieldtype": "Link", + "label": __("Supplier"), "fieldname": "supplier", - "options": doc.suppliers.map(d => { - if (d.supplier !== d.supplier_name){ - return `${d.supplier_name} [${d.supplier}]` - }else { - return d.supplier - } - }), + "options": 'Supplier', "reqd": 1, - "default": doc.suppliers.length === 1 ? doc.suppliers[0].supplier_name : "" }, + get_query: () => { + return { + filters: [ + ["Supplier", "name", "in", frm.doc.suppliers.map((row) => {return row.supplier;})] + ] + } + } + } ], primary_action_label: __("Create"), primary_action: (args) => {