Skip to content

Commit

Permalink
[IMP] default_group_by can use a non relational field
Browse files Browse the repository at this point in the history
  • Loading branch information
IJOL committed Oct 17, 2024
1 parent 534b429 commit 832c06a
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions web_timeline/static/src/js/timeline_controller.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,20 @@ export default AbstractController.extend({
*/
_onGroupClick: function (event) {
const groupField = this.renderer.last_group_bys[0];
return this.do_action({
type: "ir.actions.act_window",
res_model: this.renderer.fields[groupField].relation,
res_id: event.data.item.group,
target: "new",
views: [[false, "form"]],
});
const field = this.renderer.fields[groupField];
if (field.relation) {
return this.do_action({
type: "ir.actions.act_window",
res_model: field.relation,
res_id: event.data.item.group,
target: "new",
views: [[false, "form"]],
});
} else {
console.warn(`Field ${groupField} is not a relational field.`);
return $.Deferred().resolve();
}
},

/**
* Triggered on double-click on an item in read-only mode (otherwise, we use _onUpdate).
*
Expand Down

0 comments on commit 832c06a

Please sign in to comment.