Hide Some Script Report Filter when Print

Hi All,

I have a script report base on sale invoice, and this report have many filters option.

The report preview is working perfect, but When I print out the filters option take haft page of paper. See picture below.

Is there any way to hide some report filter that not set or any field that we want to hide?

Thanks,

Any Solution??

@Majid_Asghar @Pheakdey_Tes if you are using script reports you can just add a print format built from scratch using html . just add a .gtml fine in the same folder of the report

Hi @bahaou,

Thanks for your response. It is General Ledger report.

I ready know that solution, but if I have 20 report I have to do all report that I want to hide filter. And also when I print report and pick some column it will revert to the original design not my template

This still problem for me and my client.

I ready need this.
Thank

1 Like

@Pheakdey_Tes
@bahaou
Have you found any solution? I also want to hide filters in the report print

Since I got so much complaint from user that I set up for them, I end up fork frappe project from github and edit core file.

I try to override js code but I don’t know how to do it. if anyone know how to override this js method, please let me know hot to.

and here is what I did.
1. In your_script_report_name.js add new key

2.modified js method below in this location
/apps/frappe/frappe/public/js/frappe/views/reports/query_report.js

here is code

....
get_filters_html_for_print() {
		const applied_filters = this.get_filter_values();
		return Object.keys(applied_filters)
			.map((fieldname) => {
				
				const docfield = frappe.query_report.get_filter(fieldname).df;
				if((docfield.hide_in_print || 0)==0){
					const value = applied_filters[fieldname];
					return `${__(docfield.label)}: <strong>${frappe.format(value, docfield)}</strong>`;
					
				}else {
					return ""
				}
				
			})
			.filter(r=>r)
			.join(" / ");
	}
----

this is not recommended. Every time I run bench update --reset this code above is lost, and I have to update it again.

Hope this help.

2 Likes

Thank you
but not working on default reports like sales analytics I want to hide all filters from report’s print view
do you have any solution?

what is .gtml file & how is it different from .html file ?