From 4a1d3f16ce06b0b09717626c729d36c65b5d7c43 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Fri, 6 Sep 2013 17:01:01 +0200 Subject: [PATCH] [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 --- addons/web/static/src/js/data.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js index 26807a2ee0f..a4fbb364a21 100644 --- a/addons/web/static/src/js/data.js +++ b/addons/web/static/src/js/data.js @@ -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); }, /**