[FIX] length management in dataset when items are removed from list view

bzr revid: xmo@openerp.com-20120306163841-4ko7el1t54xwguxr
This commit is contained in:
Xavier Morel 2012-03-06 17:38:41 +01:00
parent 8b13a99967
commit d05add0c7d
2 changed files with 5 additions and 1 deletions

View File

@ -890,7 +890,10 @@ openerp.web.DataSetSearch = openerp.web.DataSet.extend(/** @lends openerp.web.D
unlink: function(ids, callback, error_callback) {
var self = this;
return this._super(ids, function(result) {
self.ids = _.without.apply(_, [self.ids].concat(ids));
self.ids = _(self.ids).difference(ids);
if (self._length) {
self._length -= 1;
}
if (this.index !== null) {
self.index = self.index <= self.ids.length - 1 ?
self.index : (self.ids.length > 0 ? self.ids.length -1 : 0);

View File

@ -291,6 +291,7 @@ openerp.web.ListView = openerp.web.View.extend( /** @lends openerp.web.ListView#
*/
configure_pager: function (dataset) {
this.dataset.ids = dataset.ids;
this.dataset._length = dataset._length;
var limit = this.limit(),
total = dataset.size(),