summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/data.js
diff options
context:
space:
mode:
Diffstat (limited to 'addons/web/static/src/js/data.js')
-rw-r--r--addons/web/static/src/js/data.js15
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