diff options
| author | Christophe Simonis <chs@openerp.com> | 2013-06-11 17:52:51 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@openerp.com> | 2013-06-11 17:52:51 +0200 |
| commit | 62636737206edde6f377534980acfb54c889e0cb (patch) | |
| tree | f129c719a8b79131b3f09d599e75e1f78882cc45 /addons/web/static/src/js/data.js | |
| parent | 3587f43662c3fec97a6a8aacc269f35902836cf8 (diff) | |
| parent | ce68573126efe2386b9c4c1c2013c89b6d037a15 (diff) | |
[MERGE] forward port of branch 7.0 up to revid 3973 chs@openerp.com-20130611145028-f98x6inytlr3ijjg
bzr revid: chs@openerp.com-20130611155251-zk0qkk70z30n81vl
Diffstat (limited to 'addons/web/static/src/js/data.js')
| -rw-r--r-- | addons/web/static/src/js/data.js | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js index d60f72c6577..679afe77bcd 100644 --- a/addons/web/static/src/js/data.js +++ b/addons/web/static/src/js/data.js @@ -490,7 +490,12 @@ instance.web.DataSet = instance.web.Class.extend(instance.web.PropertiesMixin, * @returns {$.Deferred} */ create: function(data, options) { - return this._model.call('create', [data], {context: this.get_context()}); + var self = this; + return this._model.call('create', [data], { + context: this.get_context() + }).done(function () { + self.trigger('dataset_changed', data, options) + }); }, /** * Saves the provided data in an existing db record @@ -505,7 +510,12 @@ instance.web.DataSet = instance.web.Class.extend(instance.web.PropertiesMixin, */ write: function (id, data, options) { options = options || {}; - return this._model.call('write', [[id], data], {context: this.get_context(options.context)}).done(this.trigger('dataset_changed', id, data, options)); + var self = this; + return this._model.call('write', [[id], data], { + context: this.get_context(options.context) + }).done(function () { + self.trigger('dataset_changed', id, data, options) + }); }, /** * Deletes an existing record from the database @@ -513,7 +523,12 @@ instance.web.DataSet = instance.web.Class.extend(instance.web.PropertiesMixin, * @param {Number|String} ids identifier of the record to delete */ unlink: function(ids) { - return this._model.call('unlink', [ids], {context: this.get_context()}).done(this.trigger('dataset_changed', ids)); + var self = this; + return this._model.call('unlink', [ids], { + context: this.get_context() + }).done(function () { + self.trigger('dataset_changed', ids) + }); }, /** * Calls an arbitrary RPC method @@ -610,6 +625,10 @@ instance.web.DataSet = instance.web.Class.extend(instance.web.PropertiesMixin, remove_ids: function (ids) { this.alter_ids(_(this.ids).difference(ids)); }, + add_ids: function(ids, at) { + var args = [at, 0].concat(_.difference(ids, this.ids)); + this.ids.splice.apply(this.ids, args); + }, /** * Resequence records. * |
