feat: Add 'Created By' to default sidebar filters
This commit is contained in:
parent
10e20adcf3
commit
5087f4ced0
2 changed files with 11 additions and 6 deletions
|
|
@ -7,7 +7,7 @@ frappe.views.ListGroupBy = class ListGroupBy {
|
|||
this.make_wrapper();
|
||||
|
||||
this.user_settings = frappe.get_user_settings(this.doctype);
|
||||
this.group_by_fields = ['assigned_to'];
|
||||
this.group_by_fields = ['assigned_to', 'owner'];
|
||||
if(this.user_settings.group_by_fields) {
|
||||
this.group_by_fields = this.group_by_fields.concat(this.user_settings.group_by_fields);
|
||||
}
|
||||
|
|
@ -24,7 +24,7 @@ frappe.views.ListGroupBy = class ListGroupBy {
|
|||
});
|
||||
d.set_primary_action("Save", ({ group_by_fields }) => {
|
||||
frappe.model.user_settings.save(this.doctype, 'group_by_fields', group_by_fields || null);
|
||||
this.group_by_fields = group_by_fields ? ['assigned_to', ...group_by_fields] : ['assigned_to'];
|
||||
this.group_by_fields = group_by_fields ? ['assigned_to', 'owner', ...group_by_fields] : ['assigned_to', 'owner'];
|
||||
this.render_group_by_items();
|
||||
d.hide();
|
||||
});
|
||||
|
|
@ -53,9 +53,14 @@ frappe.views.ListGroupBy = class ListGroupBy {
|
|||
|
||||
render_group_by_items() {
|
||||
let get_item_html = (fieldname) => {
|
||||
let label = fieldname === 'assigned_to'
|
||||
? __('Assigned To')
|
||||
: frappe.meta.get_label(this.doctype, fieldname);
|
||||
let label;
|
||||
if (fieldname === 'assigned_to') {
|
||||
label = __('Assigned To');
|
||||
} else if (fieldname === 'owner') {
|
||||
label = __('Created By');
|
||||
} else {
|
||||
label = frappe.meta.get_label(this.doctype, fieldname);
|
||||
}
|
||||
|
||||
return `<li class="group-by-field list-link">
|
||||
<div class="btn-group">
|
||||
|
|
|
|||
|
|
@ -399,7 +399,7 @@ body[data-route^="Module"] .main-menu {
|
|||
.group-by-dropdown, .list-stats-dropdown {
|
||||
max-height: 300px;
|
||||
overflow-y: auto;
|
||||
max-width: 200px;
|
||||
max-width: 250px;
|
||||
}
|
||||
.dropdown-search {
|
||||
padding: 8px;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue