0

As I have seen in this video : https://www.youtube.com/watch?v=iD2kb51Q7xg

...the feature "Group by many2many field" in Tree- and Gantt- views is available in Odoo 15: enter image description here

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 its 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 get the corresponding module ?

sylvain
  • 853
  • 1
  • 7
  • 20

1 Answers1

0

If you need it you need it. Go for it and downgrade it in order to get it working with v13 widgets. Everything it's possible and you already have an example of how it should work

aekis.dev
  • 2,626
  • 1
  • 12
  • 19
  • Thx but after having spend hours trying to integrate it in o13, it has turned out, that many core js and py core-dependencies have to be updated too in order to work properly – sylvain Jul 20 '23 at 10:23
  • That happens a lot with Odoo JS customizations – aekis.dev Jul 20 '23 at 16:34