diff options
Diffstat (limited to 'addons/web/static/src/js/views/graph/graph_controller.js')
| -rw-r--r-- | addons/web/static/src/js/views/graph/graph_controller.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/addons/web/static/src/js/views/graph/graph_controller.js b/addons/web/static/src/js/views/graph/graph_controller.js index f47bfaeb5bb..eb5fd107081 100644 --- a/addons/web/static/src/js/views/graph/graph_controller.js +++ b/addons/web/static/src/js/views/graph/graph_controller.js @@ -23,6 +23,7 @@ class CarretDropdownMenu extends DropdownMenu { var GraphController = AbstractController.extend({ custom_events: _.extend({}, AbstractController.prototype.custom_events, { item_selected: '_onItemSelected', + open_view: '_onOpenView', }), /** @@ -42,6 +43,9 @@ var GraphController = AbstractController.extend({ // button in the control panel owned by the graph view. this.isEmbedded = params.isEmbedded; this.withButtons = params.withButtons; + // views to use in the action triggered when the graph is clicked + this.views = params.views; + this.title = params.title; // this parameter determines what is the list of fields // that may be used within the groupby menu available when @@ -296,6 +300,32 @@ var GraphController = AbstractController.extend({ this.measureMenu.update({ items: this.measures }); } }, + + /** + * @private + * @param {OdooEvent} ev + * @param {Array[]} ev.data.domain + */ + _onOpenView(ev) { + ev.stopPropagation(); + const state = this.model.get(); + const context = Object.assign({}, state.context); + Object.keys(context).forEach(x => { + if (x === 'group_by' || x.startsWith('search_default_')) { + delete context[x]; + } + }); + this.do_action({ + context: context, + domain: ev.data.domain, + name: this.title, + res_model: this.modelName, + target: 'current', + type: 'ir.actions.act_window', + view_mode: 'list', + views: this.views, + }); + }, }); return GraphController; |
