As I have seen in this video : https://www.youtube.com/watch?v=iD2kb51Q7xg
, the feature "Group by many2many field" in Tree view is available in Odoo 15:
I have already found pieces of code corresponding to this feature in groupby_menu.js in the web module:
_validateField(field) { return (field.type === "many2many" ? field.store : field.sortable) && field.name !== "id" && GROUPABLE_TYPES.includes(field.type); }
and in the module web_gantt, in the file gantt_model.js :
const isM2MGrouped = this.ganttData.fields[groupedByField].type === "many2many"; let groupedRecords; if (isM2MGrouped) { groupedRecords = {}; for (const [key, currentGroup] of Object.entries(currentLevelGroups)) { groupedRecords[key] = []; const value = currentGroup[0][groupedByField]; for (const r of records || []) { if ( !value && r[groupedByField].length === 0 || value && r[groupedByField].includes(value[0]) ) { groupedRecords[key].push(r) } } } } else { groupedRecords = groupBy(records || [], groupedByField); }
Has anyone advice to add this feature properly to odoo 13 or to purchase the corresponding module (or in OCA)?