diff --git a/erpnext/manufacturing/doctype/production_plan/production_plan.js b/erpnext/manufacturing/doctype/production_plan/production_plan.js index d420b2057634d2f207f0fc78d377c766a850266b..caf0484a2c9212e2596c2301eb48c8910f858b57 100644 --- a/erpnext/manufacturing/doctype/production_plan/production_plan.js +++ b/erpnext/manufacturing/doctype/production_plan/production_plan.js @@ -381,18 +381,39 @@ frappe.ui.form.on('Production Plan', { }, download_materials_required(frm) { - const fields = [{ - fieldname: 'warehouses', - fieldtype: 'Table MultiSelect', - label: __('Warehouses'), - default: frm.doc.from_warehouse, - options: "Production Plan Material Request Warehouse", - get_query: function () { - return { - filters: { - company: frm.doc.company - } - }; + const warehouses_data = [ + { + warehouse: frm.doc.for_warehouse, + }, + ]; + const fields = [ + { + fieldname: "warehouses", + fieldtype: "Table MultiSelect", + label: __("Warehouses"), + default: warehouses_data, + options: "Production Plan Material Request Warehouse", + reqd: 1, + get_query: function () { + return { + filters: { + company: frm.doc.company, + }, + }; + }, + }, + ]; + + frappe.prompt( + fields, + (row) => { + let get_template_url = + "erpnext.manufacturing.doctype.production_plan.production_plan.download_raw_materials"; + open_url_post(frappe.request.url, { + cmd: get_template_url, + doc: frm.doc, + warehouses: row.warehouses, + }); }, }];