diff options
| author | niv-openerp <nicolas.vanhoren@openerp.com> | 2012-10-16 10:40:01 +0200 |
|---|---|---|
| committer | niv-openerp <nicolas.vanhoren@openerp.com> | 2012-10-16 10:40:01 +0200 |
| commit | ebe002fb42b2e1da096d9ab18764099de6ddc8b9 (patch) | |
| tree | c6b888d8dcede6548798e086ed27b516a43d9c3f /addons/web/static/src/js/data.js | |
| parent | 0c1b8b5a4cf0987af967dd206d451d9a95639430 (diff) | |
| parent | 015c07bc6fa145777257a690c2800ba4ee421254 (diff) | |
Merge trunk
bzr revid: nicolas.vanhoren@openerp.com-20121015091656-5x8nxy3116y3q7jd
bzr revid: nicolas.vanhoren@openerp.com-20121016084001-mqzq3blhb78t9e7o
Diffstat (limited to 'addons/web/static/src/js/data.js')
| -rw-r--r-- | addons/web/static/src/js/data.js | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js index 8338ce8c7c0..fe7632d0612 100644 --- a/addons/web/static/src/js/data.js +++ b/addons/web/static/src/js/data.js @@ -568,7 +568,7 @@ instance.web.DataSet = instance.web.CallbackEnabled.extend({ */ write: function (id, data, options) { options = options || {}; - return this._model.call('write', [[id], data], {context: this._model.context(options.context)}); + return this._model.call('write', [[id], data], {context: this._model.context(options.context)}).then(this.trigger('dataset_changed', id, data, options)); }, /** * Deletes an existing record from the database @@ -576,8 +576,7 @@ instance.web.DataSet = instance.web.CallbackEnabled.extend({ * @param {Number|String} ids identifier of the record to delete */ unlink: function(ids) { - this.trigger('unlink', ids); - return this._model.call('unlink', [ids], {context: this._model.context()}); + return this._model.call('unlink', [ids], {context: this._model.context()}).then(this.trigger('dataset_changed', ids)); }, /** * Calls an arbitrary RPC method @@ -779,6 +778,7 @@ instance.web.DataSetSearch = instance.web.DataSet.extend({ self.index = self.index <= self.ids.length - 1 ? self.index : (self.ids.length > 0 ? self.ids.length -1 : 0); } + this.trigger("dataset_changed", ids, callback, error_callback); }); }, size: function () { @@ -835,7 +835,7 @@ instance.web.BufferedDataSet = instance.web.DataSetStatic.extend({ } $.extend(cached.values, record.values); if (dirty) - this.on_change(); + this.trigger("dataset_changed", id, data, options); return $.Deferred().resolve(true).promise(); }, unlink: function(ids, callback, error_callback) { @@ -849,7 +849,7 @@ instance.web.BufferedDataSet = instance.web.DataSetStatic.extend({ this.to_write = _.reject(this.to_write, function(x) { return _.include(ids, x.id);}); this.cache = _.reject(this.cache, function(x) { return _.include(ids, x.id);}); this.set_ids(_.without.apply(_, [this.ids].concat(ids))); - this.on_change(); + this.trigger("dataset_changed", ids, callback, error_callback); return $.async_when({result: true}).then(callback); }, reset_ids: function(ids) { @@ -860,8 +860,6 @@ instance.web.BufferedDataSet = instance.web.DataSetStatic.extend({ this.cache = []; this.delete_all = false; }, - on_change: function() { - }, read_ids: function (ids, fields, options) { var self = this; var to_get = []; @@ -948,7 +946,7 @@ instance.web.BufferedDataSet = instance.web.DataSetStatic.extend({ }, alter_ids: function(n_ids) { this._super(n_ids); - this.on_change(); + this.trigger("dataset_changed", n_ids); }, }); instance.web.BufferedDataSet.virtual_id_regex = /^one2many_v_id_.*$/; |
