diff options
| author | Christophe Simonis <chs@odoo.com> | 2014-09-05 15:28:22 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2014-09-05 15:28:22 +0200 |
| commit | 31bf30d2d0eb78baaa36360b99fe58bf7cd4c9e7 (patch) | |
| tree | d7be61ecd6bb4c8b5552e39b03e2a64eebbbf323 /addons/web/static/src/js/data.js | |
| parent | afba9e8817c458640ae446ac7aaaab79be4fe1e9 (diff) | |
| parent | ed1c173971968eaa96693cb4e1547efa6e6c34e0 (diff) | |
[MERGE] forward port of branch 8.0 up to ed1c173
Diffstat (limited to 'addons/web/static/src/js/data.js')
| -rw-r--r-- | addons/web/static/src/js/data.js | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js index f580d282516..c22faaae9bd 100644 --- a/addons/web/static/src/js/data.js +++ b/addons/web/static/src/js/data.js @@ -73,8 +73,9 @@ instance.web.Query = instance.web.Class.extend({ } return q; }, - _execute: function () { + _execute: function (options) { var self = this; + options = options || {}; return instance.session.rpc('/web/dataset/search_read', { model: this._model.name, fields: this._fields || false, @@ -85,7 +86,7 @@ instance.web.Query = instance.web.Class.extend({ offset: this._offset, limit: this._limit, sort: instance.web.serialize_sort(this._order_by) - }).then(function (results) { + }, options).then(function (results) { self._count = results.length; return results.records; }, null); @@ -93,11 +94,12 @@ instance.web.Query = instance.web.Class.extend({ /** * Fetches the first record matching the query, or null * + * @param {Object} [options] additional options for the rpc() method * @returns {jQuery.Deferred<Object|null>} */ - first: function () { + first: function (options) { var self = this; - return this.clone({limit: 1})._execute().then(function (records) { + return this.clone({limit: 1})._execute(options).then(function (records) { delete self._count; if (records.length) { return records[0]; } return null; @@ -106,10 +108,11 @@ instance.web.Query = instance.web.Class.extend({ /** * Fetches all records matching the query * + * @param {Object} [options] additional options for the rpc() method * @returns {jQuery.Deferred<Array<>>} */ - all: function () { - return this._execute(); + all: function (options) { + return this._execute(options); }, /** * Fetches the number of records matching the query in the database |
