From 47cf31b539ade1e71450184300a338acb0cab9fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Thu, 19 Apr 2018 17:04:30 +0200 Subject: [FIX] web: prevent web client from blocking some view In some situations, it could happen that the action manager had a rejected deferred representing the creation of a view, and was blocked from doing any other interaction with that view. For example, imagine that a read operation crashes for record 1 on the model res.partner. If the user is on the kanban view and click on record 1, there will be an error dialog informing him of the error. However, if the user clicks then on another record, nothing will happen because the action manager is blocked (only the form view in this case). With this commit, whenever the view creation process failed, we also remove the rejected deferred so the action manager will be allowed to try again. --- addons/web/static/src/js/chrome/action_manager_act_window.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'addons/web/static/src/js/chrome/action_manager_act_window.js') diff --git a/addons/web/static/src/js/chrome/action_manager_act_window.js b/addons/web/static/src/js/chrome/action_manager_act_window.js index 2621071731c..39277248480 100644 --- a/addons/web/static/src/js/chrome/action_manager_act_window.js +++ b/addons/web/static/src/js/chrome/action_manager_act_window.js @@ -574,7 +574,14 @@ ActionManager.include({ }; var controllerDef = action.controllers[viewType]; - if (!controllerDef) { + if (!controllerDef || controllerDef.state() === 'rejected') { + // if the controllerDef is rejected, it probably means that the js + // code or the requests made to the server crashed. In that case, + // if we reuse the same deferred, then the switch to the view is + // definitely blocked. We want to use a new controller, even though + // it is very likely that it will recrash again. At least, it will + // give more feedback to the user, and it could happen that one + // record crashes, but not another. controllerDef = newController(); } else { controllerDef = controllerDef.then(function (controller) { -- cgit v1.2.3