Skip to content

Commit

Permalink
fix: use smaller font only if the report doesnt have a standard print…
Browse files Browse the repository at this point in the history
… format (backport #20878) (#20946)

* fix: use smaller font only if the report doesnt have a standard print format (#20878)

(cherry picked from commit 66716fb)

# Conflicts:
#	frappe/public/js/frappe/views/reports/query_report.js
#	frappe/public/js/frappe/views/reports/report_view.js

* Update frappe/public/js/frappe/views/reports/query_report.js

* Update frappe/public/js/frappe/views/reports/report_view.js

* Update frappe/public/js/frappe/views/reports/query_report.js

---------

Co-authored-by: Ritwik Puri <ritwikpuri5678@gmail.com>
  • Loading branch information
mergify[bot] and phot0n committed May 9, 2023
1 parent 688a2b4 commit 8b0c1f8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
6 changes: 4 additions & 2 deletions frappe/public/html/print_template.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@
</div>
{% endif %}

<div class="print-format {% if landscape %} landscape {% endif %}"
<div class="print-format {% if landscape %}landscape{% endif %}"
{% if columns.length > 20 %}
style="font-size: 4.0pt"
{% if can_use_smaller_font %}
style="font-size: 4.0pt"
{% endif %}
{% endif %}
>
{% if print_settings.letter_head %}
Expand Down
6 changes: 4 additions & 2 deletions frappe/public/js/frappe/views/reports/query_report.js
Original file line number Diff line number Diff line change
Expand Up @@ -1283,7 +1283,8 @@ frappe.views.QueryReport = class QueryReport extends frappe.views.BaseList {
data: this.get_data_for_print(),
columns: this.get_columns_for_print(print_settings, custom_format),
original_data: this.data,
report: this
report: this,
can_use_smaller_font: this.report_doc.is_standard === "Yes" && custom_format ? 0 : 1,
});
}

Expand Down Expand Up @@ -1320,7 +1321,8 @@ frappe.views.QueryReport = class QueryReport extends frappe.views.BaseList {
landscape: landscape,
columns: columns,
lang: frappe.boot.lang,
layout_direction: frappe.utils.is_rtl() ? "rtl" : "ltr"
layout_direction: frappe.utils.is_rtl() ? "rtl" : "ltr",
can_use_smaller_font: this.report_doc.is_standard === "Yes" && custom_format ? 0 : 1,
});

let filter_values = [],
Expand Down
3 changes: 2 additions & 1 deletion frappe/public/js/frappe/views/reports/report_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -1362,7 +1362,8 @@ frappe.views.ReportView = class ReportView extends frappe.views.ListView {
subtitle: this.get_filters_html_for_print(),
print_settings: print_settings,
columns: this.columns,
data: rows_in_order
data: rows_in_order,
can_use_smaller_font: 1,
});
});
}
Expand Down

0 comments on commit 8b0c1f8

Please sign in to comment.