[fix] Check permissions on report print/pdf

This commit is contained in:
Nabin Hait 2016-03-14 16:01:07 +05:30
parent 670b29a066
commit b2b3d8bee6

View file

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