From 9e3fe8e471f29d3fae6fe1e96df2e707bb37a058 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Tue, 13 Sep 2011 08:31:21 +0200 Subject: [PATCH] [FIX] issues with list not being a primary action view * ViewManagerAction should always instantiate a DataSetSearch, if there's a res_id add it to the DataSet * Always define a base DataGroup (groupless) on the ListView's groups, so it can be shown() without a search (will just use default dataset parameters) lp bug: https://launchpad.net/bugs/847849 fixed bzr revid: xmo@openerp.com-20110913063121-ry2cuwiuqfo655xe --- addons/web/static/src/js/list.js | 7 +++++++ addons/web/static/src/js/views.js | 9 +++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/addons/web/static/src/js/list.js b/addons/web/static/src/js/list.js index b9df9e8e2df..cca616d0055 100644 --- a/addons/web/static/src/js/list.js +++ b/addons/web/static/src/js/list.js @@ -61,6 +61,13 @@ openerp.web.ListView = openerp.web.View.extend( /** @lends openerp.web.ListView# if (this.dataset instanceof openerp.web.DataSetStatic) { this.groups.datagroup = new openerp.web.StaticDataGroup(this.dataset); + } else { + this.groups.datagroup = new openerp.web.DataGroup( + this, this.model, + dataset.get_domain(), + dataset.get_context(), + {}); + this.groups.datagroup.sort = this.dataset._sort; } this.page = 0; diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index c4309a42e38..2ae20051853 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -302,12 +302,9 @@ openerp.web.ViewManagerAction = openerp.web.ViewManager.extend({ init: function(parent, action) { this.session = parent.session; this.action = action; - var dataset; - if (!action.res_id) { - dataset = new openerp.web.DataSetSearch(this, action.res_model, action.context, action.domain); - } else { - this.action.flags.search_view = false; - dataset = new openerp.web.DataSetStatic(this, action.res_model, action.context, [action.res_id]); + var dataset = new openerp.web.DataSetSearch(this, action.res_model, action.context, action.domain); + if (action.res_id) { + dataset.ids.push(action.res_id); dataset.index = 0; } this._super(parent, dataset, action.views);