[FIX] DataSetStatic.read_slice called with no options should not blow up

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

bzr revid: xmo@openerp.com-20120120124930-zug80i862x9mwu34
This commit is contained in:
Xavier Morel 2012-01-20 13:49:30 +01:00
parent 217c180fa2
commit 7b38be7370
1 changed files with 6 additions and 6 deletions

View File

@ -309,7 +309,7 @@ openerp.web.DataSet = openerp.web.Widget.extend( /** @lends openerp.web.DataSet
* domain and context.
*
* @param {Array} [fields] fields to read and return, by default all fields are returned
* @params {Object} options
* @params {Object} [options]
* @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
* @returns {$.Deferred}
@ -504,11 +504,11 @@ openerp.web.DataSetStatic = openerp.web.DataSet.extend({
this.ids = ids || [];
},
read_slice: function (fields, options) {
options = options || {};
fields = fields || {};
// TODO remove fields from options
var self = this,
offset = options.offset || 0,
limit = options.limit || false,
fields = fields || false;
var offset = options.offset || 0,
limit = options.limit || false;
var end_pos = limit && limit !== -1 ? offset + limit : this.ids.length;
return this.read_ids(this.ids.slice(offset, end_pos), fields);
},
@ -560,8 +560,8 @@ openerp.web.DataSetSearch = openerp.web.DataSet.extend(/** @lends openerp.web.D
* @returns {$.Deferred}
*/
read_slice: function (fields, options) {
options = options || {};
var self = this;
var options = options || {};
var offset = options.offset || 0;
return this.rpc('/web/dataset/search_read', {
model: this.model,