forked from Techsystech/web
[IMP] web_filter_header_button: show groupBy filters
Now we can configure group filters to show up along the other filters so users can easily access those as well. TT4923215.0-ocabot-merge-pr-2789-by-pedrobaeza-bump-patch
parent
411eef22f2
commit
4abd48d24f
|
@ -14,6 +14,11 @@
|
||||||
name="context"
|
name="context"
|
||||||
>{'shown_in_panel': {'icon': 'fa-toggle-off', 'hotkey': 'u'}}</attribute>
|
>{'shown_in_panel': {'icon': 'fa-toggle-off', 'hotkey': 'u'}}</attribute>
|
||||||
</filter>
|
</filter>
|
||||||
|
<filter name="state" position="attributes">
|
||||||
|
<attribute
|
||||||
|
name="context"
|
||||||
|
>{'group_by':'state', 'shown_in_panel': {'icon': 'fa-th-list', 'hotkey': 's'}}</attribute>
|
||||||
|
</filter>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|
|
@ -32,5 +32,17 @@ patch(
|
||||||
}
|
}
|
||||||
return preFilter;
|
return preFilter;
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* Allow groupBy filters to show up as buttons
|
||||||
|
* @override
|
||||||
|
* @param {Object} filter
|
||||||
|
* @param {Object} attrs
|
||||||
|
*/
|
||||||
|
_extractAttributes(filter, attrs) {
|
||||||
|
this._super(...arguments);
|
||||||
|
if (filter.type === "groupBy" && attrs.context.shown_in_panel) {
|
||||||
|
filter.context = attrs.context;
|
||||||
|
}
|
||||||
|
},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -30,6 +30,9 @@ export class FilterButton extends Component {
|
||||||
favorite: {
|
favorite: {
|
||||||
color: "warning",
|
color: "warning",
|
||||||
},
|
},
|
||||||
|
groupBy: {
|
||||||
|
color: "info",
|
||||||
|
},
|
||||||
};
|
};
|
||||||
return mapping[filter.type];
|
return mapping[filter.type];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue