Merge pull request #36036 from kaulith/fix-print-empty-report

fix: Show alert if report is empty
This commit is contained in:
Ejaaz Khan 2026-01-21 17:11:56 +05:30 committed by GitHub
commit 8c25d0a0ec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -822,11 +822,13 @@ frappe.views.QueryReport = class QueryReport extends frappe.views.BaseList {
this.render_datatable();
this.add_chart_buttons_to_toolbar(true);
this.add_card_button_to_toolbar();
this.toggle_print_buttons(true);
this.$report.show();
} else {
this.data = [];
this.toggle_nothing_to_show(true);
this.add_chart_buttons_to_toolbar(false);
this.toggle_print_buttons(false);
}
this.show_footer_message();
@ -1888,7 +1890,6 @@ frappe.views.QueryReport = class QueryReport extends frappe.views.BaseList {
this.get_visible_columns(),
true
);
this.add_portrait_warning(dialog);
},
condition: () => frappe.model.can_print(this.report_doc.ref_doctype),
@ -2309,6 +2310,12 @@ frappe.views.QueryReport = class QueryReport extends frappe.views.BaseList {
this.$summary.toggle(flag);
}
toggle_print_buttons(show) {
const menu = this.page.menu;
menu.find('[data-label="Print"]').parent().parent().toggle(show);
menu.find('[data-label="PDF"]').parent().parent().toggle(show);
}
get_checked_items(only_docnames) {
const indexes = this.datatable.rowmanager.getCheckedRows();