diff options
| author | niv-openerp <nicolas.vanhoren@openerp.com> | 2011-07-18 17:28:07 +0200 |
|---|---|---|
| committer | niv-openerp <nicolas.vanhoren@openerp.com> | 2011-07-18 17:28:07 +0200 |
| commit | 193fc86c38fb2a3241e16b6afcc79627f4c1886a (patch) | |
| tree | 74be30b3592500a14b1224567556d83e1d7022f2 /addons/base/static/src/js/data.js | |
| parent | dc764a3832cffad51746149821ab527fdf9370ac (diff) | |
[fix] fix a big bug in the one2many
bzr revid: nicolas.vanhoren@openerp.com-20110718152807-bgy47f32tlx9xdzb
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 c1b64b93307..c70e23c516a 100644 --- a/addons/base/static/src/js/data.js +++ b/addons/base/static/src/js/data.js @@ -388,9 +388,6 @@ openerp.base.DataSetStatic = openerp.base.DataSet.extend({ this._super(session, 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; @@ -400,8 +397,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); @@ -478,8 +477,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); |
