Skip to content

Commit

Permalink
fix: do not allow to create dashbaord chart, number card if doesn't h…
Browse files Browse the repository at this point in the history
…ave access

(cherry picked from commit f6aafb6)
  • Loading branch information
shariquerik authored and mergify[bot] committed Aug 14, 2023
1 parent 9422000 commit 4ebb841
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 1 addition & 2 deletions frappe/desk/doctype/dashboard_chart/dashboard_chart.json
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@
}
],
"links": [],
"modified": "2022-07-27 11:09:09.203236",
"modified": "2023-08-14 16:33:30.172798",
"modified_by": "Administrator",
"module": "Desk",
"name": "Dashboard Chart",
Expand Down Expand Up @@ -319,7 +319,6 @@
"write": 1
},
{
"create": 1,
"email": 1,
"export": 1,
"print": 1,
Expand Down
2 changes: 2 additions & 0 deletions frappe/public/js/frappe/views/reports/query_report.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,14 @@ frappe.views.QueryReport = class QueryReport extends frappe.views.BaseList {
}

add_card_button_to_toolbar() {
if (!frappe.model.can_create("Number Card")) return;
this.page.add_inner_button(__("Create Card"), () => {
this.add_card_to_dashboard();
});
}

add_chart_buttons_to_toolbar(show) {
if (!frappe.model.can_create("Dashboard Chart")) return;
if (show) {
this.create_chart_button && this.create_chart_button.remove();
this.create_chart_button = this.page.add_button(__("Set Chart"), () => {
Expand Down

0 comments on commit 4ebb841

Please sign in to comment.