[FIX] avoid losing all available views when switching from graph to list via clicking on graph item

bzr revid: xmo@openerp.com-20120117164337-tuh1tkjra0drvg7r
This commit is contained in:
Xavier Morel
2012-01-17 17:43:37 +01:00
parent 387c476a1d
commit b9a290a38b
+16 -15
View File
@@ -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'}
});
},