diff options
| author | Antony Lesuisse <al@openerp.com> | 2012-10-02 00:02:48 +0200 |
|---|---|---|
| committer | Antony Lesuisse <al@openerp.com> | 2012-10-02 00:02:48 +0200 |
| commit | f025e0786071a0fa8c1edf54f43e693603b54c77 (patch) | |
| tree | 63271f292c2dc6c57490922a1a622c9b296d6f5c /addons/web/static/src/js/data.js | |
| parent | 26dbd18f2f84706fa22fd46518b4a7249c07c2ac (diff) | |
| parent | 4c9e07c538b22b74fe52006c99d082a9cdae635a (diff) | |
[MERGE] trunk-deferred-write, change r.result into r
bzr revid: al@openerp.com-20121001220248-e40r7wypgzxa3i0a
Diffstat (limited to 'addons/web/static/src/js/data.js')
| -rw-r--r-- | addons/web/static/src/js/data.js | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js index f1f8532821f..36c8eda9028 100644 --- a/addons/web/static/src/js/data.js +++ b/addons/web/static/src/js/data.js @@ -636,8 +636,7 @@ instance.web.DataSet = instance.web.CallbackEnabled.extend({ * @returns {$.Deferred} */ create: function(data) { - return this._model.call('create', [data], {context: this._model.context()}) - .pipe(function (r) { return {result: r}; }); + return this._model.call('create', [data], {context: this._model.context()}); }, /** * Saves the provided data in an existing db record @@ -648,12 +647,9 @@ 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); + return this._model.call('write', [[id], data], {context: this._model.context(options.context)}); }, /** * Deletes an existing record from the database @@ -916,9 +912,9 @@ instance.web.BufferedDataSet = instance.web.DataSetStatic.extend({ defaults: this.last_default_get}; this.to_create.push(_.extend(_.clone(cached), {values: _.clone(cached.values)})); this.cache.push(cached); - return $.Deferred().resolve({result: cached.id}).promise(); + return $.Deferred().resolve(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 +940,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(true).promise(); }, unlink: function(ids, callback, error_callback) { var self = this; @@ -1092,9 +1086,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); } |
