Merge pull request #31693 from iamejaaz/query-report-translate

fix: report header not translated
This commit is contained in:
Ejaaz Khan 2025-03-13 11:37:28 +05:30 committed by GitHub
commit 91430efdbb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1231,6 +1231,10 @@ frappe.views.QueryReport = class QueryReport extends frappe.views.BaseList {
}
prepare_columns(columns) {
let is_query_generated_report =
this.report_doc.query &&
this.report_doc.query != undefined &&
this.report_doc.query != "";
return columns.map((column) => {
column = frappe.report_utils.prepare_field_from_column(column);
@ -1279,7 +1283,9 @@ frappe.views.QueryReport = class QueryReport extends frappe.views.BaseList {
id: column.fieldname,
// The column label should have already been translated in the
// backend. Translating it again would cause unexpected behaviour.
name: column.label,
// Translating based on condition: when a report is generated through a query, the label is not translated.
name: is_query_generated_report ? __(column.label) : column.label,
width: parseInt(column.width) || null,
editable: column.editable ?? false,
compareValue: compareFn,