diff options
| author | Christophe Simonis <chs@odoo.com> | 2018-05-25 14:34:18 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2018-05-25 14:34:18 +0200 |
| commit | 37eed7c509fb5846c89ef37046df4b3cab299719 (patch) | |
| tree | f84141132c09ddafa7922375a84d5bf072265d04 /addons/web/static/src/js/views/abstract_controller.js | |
| parent | 943075fd94eec2bc61b751e8828e3bd69054b2f8 (diff) | |
| parent | 58e35522468d1d4c0674518f785a32be56d2c1a2 (diff) | |
[MERGE] forward port branch saas-11.2 up to 58e35522468
Diffstat (limited to 'addons/web/static/src/js/views/abstract_controller.js')
| -rw-r--r-- | addons/web/static/src/js/views/abstract_controller.js | 7 |
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 decaf1884b2..a3a9e04f30c 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 AbstractAction = require('web.AbstractAction'); @@ -54,6 +55,8 @@ var AbstractController = AbstractAction.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; @@ -232,11 +235,11 @@ var AbstractController = AbstractAction.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); }); |
