fix: Gives a 404 error when clicked on the Download Required Material button while the form is not saved (#20355)

This commit is contained in:
abhijitkumbharIND 2020-01-21 00:53:59 +05:30
parent 239f0d529e
commit b2f08a7a42

View File

@ -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 });
},