fix(report-view): Honor disable_auto_refresh and disable_count (#17641)
This commit is contained in:
parent
3de50b1c84
commit
97429e8012
3 changed files with 21 additions and 8 deletions
|
|
@ -69,6 +69,14 @@ frappe.views.BaseList = class BaseList {
|
|||
];
|
||||
}
|
||||
|
||||
get_list_view_settings() {
|
||||
return frappe
|
||||
.call("frappe.desk.listview.get_list_settings", {
|
||||
doctype: this.doctype,
|
||||
})
|
||||
.then((doc) => (this.list_view_settings = doc.message || {}));
|
||||
}
|
||||
|
||||
setup_fields() {
|
||||
this.set_fields();
|
||||
this.build_fields();
|
||||
|
|
|
|||
|
|
@ -107,14 +107,6 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList {
|
|||
return this.get_list_view_settings();
|
||||
}
|
||||
|
||||
get_list_view_settings() {
|
||||
return frappe
|
||||
.call("frappe.desk.listview.get_list_settings", {
|
||||
doctype: this.doctype,
|
||||
})
|
||||
.then((doc) => (this.list_view_settings = doc.message || {}));
|
||||
}
|
||||
|
||||
on_sort_change(sort_by, sort_order) {
|
||||
this.sort_by = sort_by;
|
||||
this.sort_order = sort_order;
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ frappe.views.ReportView = class ReportView extends frappe.views.ListView {
|
|||
this.add_totals_row = this.view_user_settings.add_totals_row || 0;
|
||||
this.chart_args = this.view_user_settings.chart_args;
|
||||
}
|
||||
return this.get_list_view_settings();
|
||||
}
|
||||
|
||||
setup_view() {
|
||||
|
|
@ -53,6 +54,9 @@ frappe.views.ReportView = class ReportView extends frappe.views.ListView {
|
|||
}
|
||||
|
||||
setup_events() {
|
||||
if (this.list_view_settings?.disable_auto_refresh) {
|
||||
return;
|
||||
}
|
||||
frappe.realtime.on("list_update", (data) => this.on_update(data));
|
||||
}
|
||||
|
||||
|
|
@ -216,6 +220,9 @@ frappe.views.ReportView = class ReportView extends frappe.views.ListView {
|
|||
}
|
||||
|
||||
render_count() {
|
||||
if (this.list_view_settings?.disable_count) {
|
||||
return;
|
||||
}
|
||||
let $list_count = this.$paging_area.find('.list-count');
|
||||
if (!$list_count.length) {
|
||||
$list_count = $('<span>')
|
||||
|
|
@ -1540,6 +1547,12 @@ frappe.views.ReportView = class ReportView extends frappe.views.ListView {
|
|||
});
|
||||
}
|
||||
|
||||
if (frappe.user.has_role("System Manager")) {
|
||||
if (this.get_view_settings) {
|
||||
items.push(this.get_view_settings());
|
||||
}
|
||||
}
|
||||
|
||||
return items.map(i => Object.assign(i, { standard: true }));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue