fix: format filter values in report print view (#20717)

Co-authored-by: Michael Weißer <michael.weisser@rindenmuehle.de>
This commit is contained in:
P-Froggy 2023-04-18 07:56:18 +02:00 committed by GitHub
parent c1af128aba
commit af500bb3f5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 5 deletions

View file

@ -1424,9 +1424,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("");
}

View file

@ -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("");
}