From 47e709eb735f0fab8ee53c802e1352ee445d52cc Mon Sep 17 00:00:00 2001 From: Antony Lesuisse Date: Fri, 19 Aug 2011 00:57:21 +0200 Subject: [IMP] read_slice fields outside option [] are probably bugs bzr revid: al@openerp.com-20110818225721-tn1vl2450tbe11d6 --- addons/base/static/src/js/data.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'addons/base/static/src/js/data.js') diff --git a/addons/base/static/src/js/data.js b/addons/base/static/src/js/data.js index 244c057d544..2dac0bb5ae4 100644 --- a/addons/base/static/src/js/data.js +++ b/addons/base/static/src/js/data.js @@ -286,14 +286,16 @@ openerp.base.DataSet = openerp.base.Widget.extend( /** @lends openerp.base.Data * Read a slice of the records represented by this DataSet, based on its * domain and context. * + * @param {Array} [fields] fields to read and return, by default all fields are returned * @params {Object} options - * @param {Array} [options.fields] fields to read and return, by default all fields are returned * @param {Number} [options.offset=0] The index from which selected records should be returned * @param {Number} [options.limit=null] The maximum number of records to return * @param {Function} callback function called with read_slice result * @returns {$.Deferred} */ - read_slice: function (options, callback) { return null; }, + read_slice: function (fields, options, callback) { + return null; + }, /** * Reads the current dataset record (from its index) * @@ -478,11 +480,12 @@ openerp.base.DataSetStatic = openerp.base.DataSet.extend({ // all local records this.ids = ids || []; }, - read_slice: function (options, callback) { + read_slice: function (fields, options, callback) { + // TODO remove fields from options var self = this, offset = options.offset || 0, limit = options.limit || false, - fields = options.fields || false; + fields = fields || false; var end_pos = limit && limit !== -1 ? offset + limit : undefined; return this.read_ids(this.ids.slice(offset, end_pos), fields, callback); }, @@ -532,12 +535,12 @@ openerp.base.DataSetSearch = openerp.base.DataSet.extend({ * @param {Function} callback function called with read_slice result * @returns {$.Deferred} */ - read_slice: function (options, callback) { + read_slice: function (fields, options, callback) { var self = this; var offset = options.offset || 0; return this.rpc('/base/dataset/search_read', { model: this.model, - fields: options.fields || false, + fields: fields || false, domain: this.get_domain(options.domain), context: this.get_context(options.context), sort: this.sort(), -- cgit v1.2.3 From 056a91f72439ae99f1df02a75c30aafc13bd3648 Mon Sep 17 00:00:00 2001 From: Antony Lesuisse Date: Fri, 19 Aug 2011 01:38:11 +0200 Subject: [IMP] web_rpc example bzr revid: al@openerp.com-20110818233811-yiee3czhbtc6p3ob --- addons/base/static/src/js/data.js | 1 + 1 file changed, 1 insertion(+) (limited to 'addons/base/static/src/js/data.js') diff --git a/addons/base/static/src/js/data.js b/addons/base/static/src/js/data.js index 2dac0bb5ae4..04c23224806 100644 --- a/addons/base/static/src/js/data.js +++ b/addons/base/static/src/js/data.js @@ -537,6 +537,7 @@ openerp.base.DataSetSearch = openerp.base.DataSet.extend({ */ read_slice: function (fields, options, callback) { var self = this; + var options = options || {}; var offset = options.offset || 0; return this.rpc('/base/dataset/search_read', { model: this.model, -- cgit v1.2.3