summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2018-05-25 11:50:02 +0200
committerChristophe Simonis <chs@odoo.com>2018-05-25 11:50:02 +0200
commit58e35522468d1d4c0674518f785a32be56d2c1a2 (patch)
tree8e7ed12dcdf6d59f1b76c400e1db1a3ac882ec0e /addons/web/static/src
parentb2aab354c4a6bcd37cded7c2d0129d9e1cc5d87d (diff)
parent2ca72960001b83c774b00e271266d9326dd5fe04 (diff)
[MERGE] forward port branch 11.0 up to 2ca72960001
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/views/abstract_controller.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/addons/web/static/src/js/views/abstract_controller.js b/addons/web/static/src/js/views/abstract_controller.js
index ff7ab5a43bb..fbddb28eab7 100644
--- a/addons/web/static/src/js/views/abstract_controller.js
+++ b/addons/web/static/src/js/views/abstract_controller.js
@@ -12,6 +12,7 @@ odoo.define('web.AbstractController', function (require) {
* reading localstorage, ...) has to go through the controller.
*/
+var concurrency = require('web.concurrency');
var ControlPanelMixin = require('web.ControlPanelMixin');
var core = require('web.core');
var Widget = require('web.Widget');
@@ -54,6 +55,8 @@ var AbstractController = Widget.extend(ControlPanelMixin, {
this.controllerID = params.controllerID;
this.initialState = params.initialState;
+ // use a DropPrevious to correctly handle concurrent updates
+ this.dp = new concurrency.DropPrevious();
// those arguments are temporary, they won't be necessary as soon as the
// ControlPanel will be handled by the View
this.displayName = params.displayName;
@@ -225,11 +228,11 @@ var AbstractController = Widget.extend(ControlPanelMixin, {
var self = this;
var shouldReload = (options && 'reload' in options) ? options.reload : true;
var def = shouldReload ? this.model.reload(this.handle, params) : $.when();
- return def.then(function (handle) {
+ return this.dp.add(def).then(function (handle) {
self.handle = handle || self.handle; // update handle if we reloaded
var state = self.model.get(self.handle);
var localState = self.renderer.getLocalState();
- return self.renderer.updateState(state, params).then(function () {
+ return self.dp.add(self.renderer.updateState(state, params)).then(function () {
self.renderer.setLocalState(localState);
self._update(state);
});