Add custom button in query report and download pdf without submit any conditions

Hi, I try to download the report by click custom script button in the report
but there is functions passes through some min.js files like microtemplate.js
in print format have report_to_pdf function but the html values is so confusing i attach some pictures check the process help me for resolve it…!

1…I add the custom button
2…Actual process to get pdf of the report
3…The popup screen i submit it smoothly give the pdf of the exact report…

def report_to_pdf( html ,orientation=“Landscape”):
make_access_log(file_type=‘PDF’, method=‘PDF’, page=html)
frappe.local.response.filename = “report.pdf”
frappe.local.response.filecontent = get_pdf(html, {“orientation”: orientation})
frappe.local.response.type = “pdf”

“The html for report is so confusing help to resolve”

Hey @Mystic, Can you tell me how’d you added a custom button in ERP reports

@Robot , if you’re working with script report, add in the JavaScript section of the report
frappe.query_reports[‘report_name’] = {
onload: function(report) {“Show Message”), function () {
frappe.msgprint(“Add Button”)

1 Like