[REF] web: move isM2MGrouped logic from model to list
This is only necessary for the list view, no need to add complexity to the model for this. Part of task 3179751 closes odoo/odoo#117309 Signed-off-by: Géry Debongnie <ged@odoo.com>
This commit is contained in:
@@ -248,7 +248,11 @@ export class ListController extends Component {
|
||||
}
|
||||
|
||||
getStaticActionMenuItems() {
|
||||
const isM2MGrouped = this.model.root.isM2MGrouped;
|
||||
const list = this.model.root;
|
||||
const isM2MGrouped = list.groupBy.some((groupBy) => {
|
||||
const fieldName = groupBy.split(":")[0];
|
||||
return list.fields[fieldName].type === "many2many";
|
||||
});
|
||||
return {
|
||||
export: {
|
||||
isAvailable: () => this.isExportEnable,
|
||||
|
||||
@@ -1600,13 +1600,6 @@ class DynamicList extends DataPoint {
|
||||
};
|
||||
}
|
||||
|
||||
get isM2MGrouped() {
|
||||
return this.groupBy.some((groupBy) => {
|
||||
const fieldName = groupBy.split(":")[0];
|
||||
return this.fields[fieldName].type === "many2many";
|
||||
});
|
||||
}
|
||||
|
||||
get selection() {
|
||||
return this.records.filter((r) => r.selected);
|
||||
}
|
||||
|
||||
@@ -3335,7 +3335,7 @@ QUnit.module("Views", (hooks) => {
|
||||
serverData,
|
||||
arch: '<tree><field name="foo"/><field name="bar"/></tree>',
|
||||
groupBy: ["date:year"],
|
||||
// keep the actionMenus, it is relevant as it calls isM2MGrouped which crashes if we
|
||||
// keep the actionMenus, it is relevant as it computes isM2MGrouped which crashes if we
|
||||
// don't correctly extract the fieldName/granularity from the groupBy
|
||||
actionMenus: {},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user