[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
This commit is contained in:
Xavier Morel 2011-09-13 08:31:21 +02:00
parent 1605fb8f50
commit 9e3fe8e471
2 changed files with 10 additions and 6 deletions

View File

@ -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;

View File

@ -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);