From b2b3d8bee6e87b078b0dee2bfedf8f2e665acf5f Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 14 Mar 2016 16:01:07 +0530 Subject: [PATCH] [fix] Check permissions on report print/pdf --- frappe/public/js/frappe/views/reports/query_report.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/frappe/public/js/frappe/views/reports/query_report.js b/frappe/public/js/frappe/views/reports/query_report.js index 85ffa0b2db..c409bb5162 100644 --- a/frappe/public/js/frappe/views/reports/query_report.js +++ b/frappe/public/js/frappe/views/reports/query_report.js @@ -139,6 +139,11 @@ frappe.views.QueryReport = Class.extend({ } }, print_report: function() { + if(!frappe.model.can_print(this.report_doc.ref_doctype)) { + msgprint(__("You are not allowed to print this report")); + return false; + } + if(this.html_format) { var content = frappe.render(this.html_format, {data: this.dataView.getItems(), filters:this.get_values(), report:this}); @@ -149,6 +154,11 @@ frappe.views.QueryReport = Class.extend({ } }, pdf_report: function() { + if(!frappe.model.can_print(this.report_doc.ref_doctype)) { + msgprint(__("You are not allowed to make PDF for this report")); + return false; + } + if(this.html_format) { var content = frappe.render(this.html_format, {data: this.dataView.getItems(), filters:this.get_values(), report:this});