Merge pull request #34049 from aerele/show-or-hide-filters-in-print-view

feat: provide an option to show or hide applied filters in report pri…
This commit is contained in:
Ejaaz Khan 2025-09-19 14:31:07 +05:30 committed by GitHub
commit 0ab0cd7d9c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 23 additions and 7 deletions

View file

@ -1,4 +1,10 @@
frappe.ui.get_print_settings = function (pdf, callback, letter_head, pick_columns) {
frappe.ui.get_print_settings = function (
pdf,
callback,
letter_head,
pick_columns,
has_filters = false
) {
var print_settings = locals[":Print Settings"]["Print Settings"];
var company = frappe.defaults.get_default("company");
@ -48,6 +54,14 @@ frappe.ui.get_print_settings = function (pdf, callback, letter_head, pick_column
},
];
if (has_filters) {
columns.push({
label: __("Include filters"),
fieldtype: "Check",
fieldname: "include_filters",
});
}
if (pick_columns) {
columns.push(
{

View file

@ -4,8 +4,8 @@
<hr>
{% endif %}
{% if subtitle %}
{{ subtitle }}
<hr>
{{ subtitle }}
<hr>
{% endif %}
<table class="table table-bordered">
<!-- heading -->

View file

@ -1496,7 +1496,7 @@ frappe.views.QueryReport = class QueryReport extends frappe.views.BaseList {
frappe.render_grid({
template: print_settings.columns ? "print_grid" : custom_format,
title: __(this.report_name),
subtitle: filters_html,
subtitle: print_settings?.include_filters ? filters_html : null,
print_settings: print_settings,
landscape: landscape,
filters: this.get_filter_values(),
@ -1526,7 +1526,7 @@ frappe.views.QueryReport = class QueryReport extends frappe.views.BaseList {
const template = print_settings.columns || !custom_format ? "print_grid" : custom_format;
const content = frappe.render_template(template, {
title: __(this.report_name),
subtitle: filters_html,
subtitle: print_settings?.include_filters ? filters_html : null,
filters: applied_filters,
data: data,
original_data: this.data,
@ -1792,7 +1792,8 @@ frappe.views.QueryReport = class QueryReport extends frappe.views.BaseList {
false,
(print_settings) => this.print_report(print_settings),
this.report_doc.letter_head,
this.get_visible_columns()
this.get_visible_columns(),
true
);
this.add_portrait_warning(dialog);
},
@ -1806,7 +1807,8 @@ frappe.views.QueryReport = class QueryReport extends frappe.views.BaseList {
false,
(print_settings) => this.pdf_report(print_settings),
this.report_doc.letter_head,
this.get_visible_columns()
this.get_visible_columns(),
true
);
this.add_portrait_warning(dialog);