diff options
| author | niv-openerp <nicolas.vanhoren@openerp.com> | 2011-07-18 17:31:35 +0200 |
|---|---|---|
| committer | niv-openerp <nicolas.vanhoren@openerp.com> | 2011-07-18 17:31:35 +0200 |
| commit | df5c5ae319a39093f3d3d03fb2c5783e39d1e2b4 (patch) | |
| tree | 550ef032947e2872136bd2a6601013c88635f0a7 /addons/base/static/src/js/data.js | |
| parent | 711b22f52cb4876509abbdc029dd6a1303b474f9 (diff) | |
| parent | da5f320a0a72c0fa4bcf2a415556f469104402da (diff) | |
[fix] some fixes related to o2m
bzr revid: nicolas.vanhoren@openerp.com-20110718153135-1s6d2n99xafrozpv
Diffstat (limited to 'addons/base/static/src/js/data.js')
| -rw-r--r-- | addons/base/static/src/js/data.js | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/addons/base/static/src/js/data.js b/addons/base/static/src/js/data.js index aeb9f0b096a..90b4b7c002d 100644 --- a/addons/base/static/src/js/data.js +++ b/addons/base/static/src/js/data.js @@ -381,9 +381,6 @@ openerp.base.DataSetStatic = openerp.base.DataSet.extend({ this._super(parent, model, context); // all local records this.ids = ids || []; - if (this.ids.length) { - this.index = 0; - } }, read_slice: function (fields, offset, limit, callback) { var self = this; @@ -393,8 +390,10 @@ openerp.base.DataSetStatic = openerp.base.DataSet.extend({ }, set_ids: function (ids) { this.ids = ids; - this.index = this.index <= this.ids.length - 1 ? - this.index : (this.ids.length > 0 ? this.length - 1 : 0); + if (this.index !== null) { + this.index = this.index <= this.ids.length - 1 ? + this.index : (this.ids.length > 0 ? this.length - 1 : 0); + } }, unlink: function(ids) { this.on_unlink(ids); @@ -470,8 +469,10 @@ openerp.base.DataSetSearch = openerp.base.DataSet.extend({ var self = this; return this._super(ids, function(result) { self.ids = _.without.apply(_, [self.ids].concat(ids)); - self.index = self.index <= self.ids.length - 1 ? - self.index : (self.ids.length > 0 ? self.ids.length -1 : 0); + if (this.index !== null) { + self.index = self.index <= self.ids.length - 1 ? + self.index : (self.ids.length > 0 ? self.ids.length -1 : 0); + } if (callback) callback(result); }, error_callback); |
