From 49ef15883da867f75d14d25125e149ff544c39fd Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Mon, 15 Apr 2024 21:33:17 +0530 Subject: [PATCH] fix: added translation for fielname labels shown in filter, sort & columns --- crm/api/doc.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/crm/api/doc.py b/crm/api/doc.py index 6d3814ae..20da945a 100644 --- a/crm/api/doc.py +++ b/crm/api/doc.py @@ -14,7 +14,7 @@ def sort_options(doctype: str): fields = [field for field in fields if field.fieldtype not in no_value_fields] fields = [ { - "label": field.label, + "label": _(field.label), "value": field.fieldname, } for field in fields @@ -30,6 +30,7 @@ def sort_options(doctype: str): ] for field in standard_fields: + field["label"] = _(field["label"]) fields.append(field) return fields @@ -102,6 +103,9 @@ def get_filterable_fields(doctype: str): field["name"] = field.get("fieldname") res.append(field) + for field in res: + field["label"] = _(field.get("label")) + return res def get_fields_meta(DocField, doctype, allowed_fieldtypes, restricted_fields): @@ -199,7 +203,7 @@ def get_list_data( fields = [field for field in fields if field.fieldtype not in no_value_fields] fields = [ { - "label": field.label, + "label": _(field.label), "type": field.fieldtype, "value": field.fieldname, "options": field.options, @@ -226,6 +230,7 @@ def get_list_data( if field.get('value') not in rows: rows.append(field.get('value')) if field not in fields: + field["label"] = _(field["label"]) fields.append(field) if not is_default and custom_view_name: