diff options
| author | Xavier Morel <xmo@openerp.com> | 2011-06-06 13:36:21 +0200 |
|---|---|---|
| committer | Xavier Morel <xmo@openerp.com> | 2011-06-06 13:36:21 +0200 |
| commit | c452d85a7a4cb97beb702abe6471c6c788138e9b (patch) | |
| tree | 4afc2fff2e03b566f4d604f550a0296077b18624 /addons/base/static/src/js/data.js | |
| parent | efbde798bc2fbfe4ab659c08801551e7bece7c1a (diff) | |
| parent | dc91f906f758ab6150ba927f996b43bbee82b268 (diff) | |
[MERGE] from trunk
bzr revid: xmo@openerp.com-20110606113621-r3q0otfjdu7l0ubp
Diffstat (limited to 'addons/base/static/src/js/data.js')
| -rw-r--r-- | addons/base/static/src/js/data.js | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/addons/base/static/src/js/data.js b/addons/base/static/src/js/data.js index b7739a3da27..3706b653651 100644 --- a/addons/base/static/src/js/data.js +++ b/addons/base/static/src/js/data.js @@ -310,6 +310,7 @@ openerp.base.DataSet = openerp.base.Controller.extend( /** @lends openerp.base. }, callback); }, unlink: function(ids) { + // to implement in children this.notification.notify("Unlink", ids); }, call: function (method, ids, args, callback) { @@ -343,15 +344,25 @@ openerp.base.DataSet = openerp.base.Controller.extend( /** @lends openerp.base. }); openerp.base.DataSetStatic = openerp.base.DataSet.extend({ - init: function(session, model) { + init: function(session, model, ids) { this._super(session, model); // all local records - this.ids = []; - this.count = 0; + this.ids = ids || []; + this.count = this.ids.length; }, read_slice: function (fields, offset, limit, callback) { var end_pos = limit && limit !== -1 ? offset + limit : undefined; this.read_ids(this.ids.slice(offset, end_pos), fields, callback); + }, + set_ids: function (ids) { + this.ids = ids; + this.count = this.ids.length; + }, + unlink: function(ids) { + this.on_unlink(ids); + }, + on_unlink: function(ids) { + this.set_ids(_.without.apply(null, [this.ids].concat(ids))); } }); |
