From b2f08a7a424c90da5b99f99130aa4a6a22823371 Mon Sep 17 00:00:00 2001 From: abhijitkumbharIND Date: Tue, 21 Jan 2020 00:53:59 +0530 Subject: [PATCH] fix: Gives a 404 error when clicked on the Download Required Material button while the form is not saved (#20355) --- .../manufacturing/doctype/production_plan/production_plan.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/erpnext/manufacturing/doctype/production_plan/production_plan.js b/erpnext/manufacturing/doctype/production_plan/production_plan.js index 2b168d1d76..7e25b3738b 100644 --- a/erpnext/manufacturing/doctype/production_plan/production_plan.js +++ b/erpnext/manufacturing/doctype/production_plan/production_plan.js @@ -218,6 +218,10 @@ frappe.ui.form.on('Production Plan', { }, download_materials_required: function(frm) { + if(frm.is_new()) { + frappe.throw(__("Please save the document before downloading the material required.")); + return; + } let get_template_url = 'erpnext.manufacturing.doctype.production_plan.production_plan.download_raw_materials'; open_url_post(frappe.request.url, { cmd: get_template_url, production_plan: frm.doc.name }); },