diff options
| author | Xavier Morel <xmo@openerp.com> | 2012-01-17 17:43:37 +0100 |
|---|---|---|
| committer | Xavier Morel <xmo@openerp.com> | 2012-01-17 17:43:37 +0100 |
| commit | b9a290a38bb159967b5032cbbb2759ee09239c6f (patch) | |
| tree | d8c7136acbca03e2db9a2ba7ee03461981311711 /addons/web_graph/static/src/js/graph.js | |
| parent | 387c476a1defefbd2d65e11561b9b458fbdd5436 (diff) | |
[FIX] avoid losing all available views when switching from graph to list via clicking on graph item
bzr revid: xmo@openerp.com-20120117164337-tuh1tkjra0drvg7r
Diffstat (limited to 'addons/web_graph/static/src/js/graph.js')
| -rw-r--r-- | addons/web_graph/static/src/js/graph.js | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/addons/web_graph/static/src/js/graph.js b/addons/web_graph/static/src/js/graph.js index 1c286795a91..f153a2155f0 100644 --- a/addons/web_graph/static/src/js/graph.js +++ b/addons/web_graph/static/src/js/graph.js @@ -398,23 +398,24 @@ openerp.web_graph.GraphView = openerp.web.View.extend({ id = id[0]; } - var record_id = this.abscissa; - var modes = ["list", "form", "graph"]; - var views = []; - _.each(modes, function(mode) { - var view = [false, mode]; - if (self.fields.views && self.fields.views[mode]) { - view.push(self.fields.views[mode]); + var views; + if (this.widget_parent.action) { + views = this.widget_parent.action.views; + if (!_(views).detect(function (view) { + return view[1] === 'list' })) { + views = [[false, 'list']].concat(views); } - views.push(view); - }); + } else { + views = _(["list", "form", "graph"]).map(function(mode) { + return [false, mode]; + }); + } this.do_action({ - "res_model" : this.dataset.model, - "domain" : [[record_id, '=', id], ['id','in',this.dataset.ids]], - "views" : views, - "type" : "ir.actions.act_window", - "view_type" : "list", - "view_mode" : "list" + res_model : this.dataset.model, + domain: [[this.abscissa, '=', id], ['id','in',this.dataset.ids]], + views: views, + type: "ir.actions.act_window", + flags: {default_view: 'list'} }); }, |
