[FIX] broken pager

Turns out when code looks somewhat odd there may well be a good reason
for it, and changing it without wondering breaks the pager.

In this case, `/web/dataset/search_read` has a significant difference
with Model.search_read: it returns the records slice specified by
(``limit``, ``offset``) but it also returns the *total number of
records* for ``domain`` which is sort-of useful to generating the
pager.

lp bug: https://launchpad.net/bugs/1218266 fixed

bzr revid: xmo@openerp.com-20130906150101-2qb349fzaz6rye36
This commit is contained in:
Xavier Morel 2013-09-06 17:01:01 +02:00
parent 6da5da7aa0
commit 4a1d3f16ce
1 changed files with 7 additions and 6 deletions

View File

@ -61,18 +61,19 @@ instance.web.Query = instance.web.Class.extend({
},
_execute: function () {
var self = this;
return this._model.call('search_read', {
return instance.session.rpc('/web/dataset/search_read', {
model: this._model.name,
fields: this._fields || false,
domain: instance.web.pyeval.eval('domains',
[this._model.domain(this._filter)]),
fields: this._fields || false,
offset: this._offset,
limit: this._limit,
order: instance.web.serialize_sort(this._order_by),
context: instance.web.pyeval.eval('contexts',
[this._model.context(this._context)]),
offset: this._offset,
limit: this._limit,
sort: instance.web.serialize_sort(this._order_by)
}).then(function (results) {
self._count = results.length;
return results;
return results.records;
}, null);
},
/**