fix: sort options in group by field

This commit is contained in:
barredterra 2023-06-15 16:15:55 +02:00
parent 09501da12f
commit 3e9a2d01e3

View file

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