diff options
| author | Vidhin Mehta (OpenERP) <vme@tinyerp.com> | 2012-10-01 14:26:09 +0530 |
|---|---|---|
| committer | Vidhin Mehta (OpenERP) <vme@tinyerp.com> | 2012-10-01 14:26:09 +0530 |
| commit | 7c701944ec18cca695a2a1bdcaed0f2ed7802688 (patch) | |
| tree | 79dcf05cb06f23fa79f21a1db98423e76602d632 /addons/web/static/src/js/data.js | |
| parent | 1370ae133d4477d0a7a2239732f529a1eef39824 (diff) | |
[IMP]remove callbacks from write method and change related code.
bzr revid: vme@tinyerp.com-20121001085609-rxdoknvpo130ehq3
Diffstat (limited to 'addons/web/static/src/js/data.js')
| -rw-r--r-- | addons/web/static/src/js/data.js | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js index f1f8532821f..ee5313e3bd8 100644 --- a/addons/web/static/src/js/data.js +++ b/addons/web/static/src/js/data.js @@ -648,12 +648,11 @@ instance.web.DataSet = instance.web.CallbackEnabled.extend({ * @param {Function} error_callback function called in case of write error * @returns {$.Deferred} */ - write: function (id, data, options, callback, error_callback) { + write: function (id, data, options) { options = options || {}; return this._model.call('write', [[id], data], {context: this._model.context(options.context)}) - .pipe(function (r) { return {result: r}}) - .then(callback, error_callback); + .pipe(function (r) { return {result: r}}); }, /** * Deletes an existing record from the database @@ -918,7 +917,7 @@ instance.web.BufferedDataSet = instance.web.DataSetStatic.extend({ this.cache.push(cached); return $.Deferred().resolve({result: cached.id}).promise(); }, - write: function (id, data, options, callback) { + write: function (id, data, options) { var self = this; var record = _.detect(this.to_create, function(x) {return x.id === id;}); record = record || _.detect(this.to_write, function(x) {return x.id === id;}); @@ -944,9 +943,7 @@ instance.web.BufferedDataSet = instance.web.DataSetStatic.extend({ $.extend(cached.values, record.values); if (dirty) this.on_change(); - var to_return = $.Deferred().then(callback); - to_return.resolve({result: true}); - return to_return.promise(); + return $.Deferred().resolve({result: true}).promise(); }, unlink: function(ids, callback, error_callback) { var self = this; @@ -1092,9 +1089,9 @@ instance.web.ProxyDataSet = instance.web.DataSetSearch.extend({ return this._super.apply(this, arguments); } }, - write: function (id, data, options, callback, error_callback) { + write: function (id, data, options) { if (this.write_function) { - return this.write_function(id, data, options, this._super).then(callback, error_callback); + return this.write_function(id, data, options, this._super); } else { return this._super.apply(this, arguments); } |
