From feeac2a4f1cd777770dd2b42534904ac71f23e46 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Thu, 25 Feb 2016 14:02:20 +0100 Subject: [FIX] web: various small issues in form view onchange/one2many - Issue: Edit sale.order form view, add new line, change product who have taxes and click quickly on save (with slow network) => error message. Because some deferreds are lost. - reduce number of reads and onchange for x2m widgets - remove before_save method and use commit_value (the issue was that if the before_save and the change trigger an onchange, the onchange deferred is not checked before saving the content. --- addons/web/static/src/js/framework/data.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'addons/web/static/src/js/framework/data.js') diff --git a/addons/web/static/src/js/framework/data.js b/addons/web/static/src/js/framework/data.js index e92bbd98c53..1e437ea2e05 100644 --- a/addons/web/static/src/js/framework/data.js +++ b/addons/web/static/src/js/framework/data.js @@ -833,9 +833,10 @@ var BufferedDataSet = DataSetStatic.extend({ }); } this.delete_all = false; - _.each(_.clone(this.running_reads), function(el) { - el.reject(); - }); + this.cancel_read(); + }, + cancel_read: function () { + _.invoke(_.clone(this.running_reads), 'reject'); }, read_ids: function (ids, fields, options) { // read what is necessary from the server to have ids and the given @@ -897,11 +898,8 @@ var BufferedDataSet = DataSetStatic.extend({ }); var _super = this._super; this.mutex.exec(function () { - _super.call(self, to_get, fields, options).then(function() { - def.resolve.apply(def, arguments); - }, function() { - def.reject.apply(def, arguments); - }); + if (def.state() !== "pending") return; + _super.call(self, to_get, fields, options).then(_.bind(def.resolve, def), _.bind(def.reject, def)); return def; }); return def.then(function(records) { -- cgit v1.2.3