Skip to content

Commit

Permalink
fix: format filter values in report print view (backport #20717) (#20752
Browse files Browse the repository at this point in the history
)

Co-authored-by: Michael Weißer <michael.weisser@rindenmuehle.de>
Co-authored-by: P-Froggy <60393001+P-Froggy@users.noreply.github.com>
  • Loading branch information
3 people committed Apr 18, 2023
1 parent 54d0dca commit 83fdb2e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions frappe/public/js/frappe/views/reports/query_report.js
Original file line number Diff line number Diff line change
Expand Up @@ -1419,9 +1419,9 @@ frappe.views.QueryReport = class QueryReport extends frappe.views.BaseList {
const applied_filters = this.get_filter_values();
return Object.keys(applied_filters)
.map((fieldname) => {
const label = frappe.query_report.get_filter(fieldname).df.label;
const docfield = frappe.query_report.get_filter(fieldname).df;
const value = applied_filters[fieldname];
return `<h6>${__(label)}: ${value}</h6>`;
return `<h6>${__(docfield.label)}: ${frappe.format(value, docfield)}</h6>`;
})
.join("");
}
Expand Down
5 changes: 2 additions & 3 deletions frappe/public/js/frappe/views/reports/report_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -1349,9 +1349,8 @@ frappe.views.ReportView = class ReportView extends frappe.views.ListView {
.map((f) => {
const [doctype, fieldname, condition, value] = f;
if (condition !== "=") return "";

const label = frappe.meta.get_label(doctype, fieldname);
return `<h6>${__(label)}: ${value}</h6>`;
const docfield = frappe.meta.get_docfield(doctype, fieldname);
return `<h6>${__(docfield.label)}: ${frappe.format(value, docfield)}</h6>`;
})
.join("");
}
Expand Down

0 comments on commit 83fdb2e

Please sign in to comment.