diff options
Diffstat (limited to 'addons/web/static/src/js/framework/data.js')
| -rw-r--r-- | addons/web/static/src/js/framework/data.js | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/addons/web/static/src/js/framework/data.js b/addons/web/static/src/js/framework/data.js index e92bbd98c53..a1b8e1602e9 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) { @@ -942,11 +940,11 @@ var BufferedDataSet = DataSetStatic.extend({ this.evict_record(id); return this._super(id, signal); }, - alter_ids: function(n_ids) { + alter_ids: function(n_ids, options) { var dirty = !_.isEqual(this.ids, n_ids); - this._super(n_ids); + this._super(n_ids, options); if (dirty) { - this.trigger("dataset_changed", n_ids); + this.trigger("dataset_changed", n_ids, options); } }, }); |
