From 3e9a2d01e3e76b416456b2816682631e1bb0e37e Mon Sep 17 00:00:00 2001 From: barredterra <14891507+barredterra@users.noreply.github.com> Date: Thu, 15 Jun 2023 16:15:55 +0200 Subject: [PATCH] fix: sort options in group by field --- frappe/public/js/frappe/ui/group_by/group_by.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/frappe/public/js/frappe/ui/group_by/group_by.js b/frappe/public/js/frappe/ui/group_by/group_by.js index f48aba1b7f..0430915782 100644 --- a/frappe/public/js/frappe/ui/group_by/group_by.js +++ b/frappe/public/js/frappe/ui/group_by/group_by.js @@ -367,7 +367,9 @@ frappe.ui.GroupBy = class { ["Select", "Link", "Data", "Int", "Check"].includes(f.fieldtype) ); const tag_field = { fieldname: "_user_tags", fieldtype: "Data", label: __("Tags") }; - this.group_by_fields[this.doctype] = fields.concat(tag_field); + this.group_by_fields[this.doctype] = fields + .concat(tag_field) + .sort((a, b) => __(a.label).localeCompare(__(b.label))); this.all_fields[this.doctype] = this.report_view.meta.fields; const standard_fields_filter = (df) => @@ -379,7 +381,8 @@ frappe.ui.GroupBy = class { const cdt = df.options; const child_table_fields = frappe.meta .get_docfields(cdt) - .filter(standard_fields_filter); + .filter(standard_fields_filter) + .sort((a, b) => __(a.label).localeCompare(__(b.label))); this.group_by_fields[cdt] = child_table_fields; this.all_fields[cdt] = child_table_fields; });