summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/chrome
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2020-09-16 12:17:41 +0000
committerAaron Bohy <aab@odoo.com>2020-09-17 06:43:57 +0000
commit9ad4a3d4b735e9666034a60f4349e3fea46fed61 (patch)
treee56156e6a6cd2ebc87ba7d2605d4a8f53f6af99b /addons/web/static/src/js/chrome
parent49f1628a1d84f1a520f61c8aeb4925c33e9241a1 (diff)
[FIX] web: handle concurrent actions at startup
This commit aims at fixing a random bug on the runbot. When loading the webclient, if there is no hash, a rpc is done to read the default action of the user. When this rpc comes back, we execute the given action (if any), or the first action (typically Discuss). The navbar is displayed as soon as possible, it doesn't wait for the first action to be executed. This means that the user can open the user menu and click on 'My Profile' before the first action is executed. Before this commit, if the user clicked before the read rpc on 'res.users' returned, the default action (or the first) one, was executed, even though the user clicked on 'My Profile' and thus asked for a specific action. So basically, the user form view was briefly shown, and then replaced by the default or first action. Whereas this is a very rare usecase in practice (the timing is really short), this sometimes made the totp tour fail. However, even if it is unlikely, the client must be robust and correctly react to concurrent requests. This commit fixes the issue by executing the 'My Profile' action in the DropPrevious. That way, if any 'doAction' is performed, other pending operations (also done in DropPrevious) are dropped. This commit also ensures that the "brand name" part in the navbar (containing the name of the current app) is hidden when there is no current app, as in the scenario described above, we land in a webclient with no current app. Note that not being in an app was something that was already handled, but not at startup. closes odoo/odoo#57840 Related: odoo/enterprise#13277 Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
Diffstat (limited to 'addons/web/static/src/js/chrome')
-rw-r--r--addons/web/static/src/js/chrome/abstract_web_client.js3
-rw-r--r--addons/web/static/src/js/chrome/menu.js1
2 files changed, 3 insertions, 1 deletions
diff --git a/addons/web/static/src/js/chrome/abstract_web_client.js b/addons/web/static/src/js/chrome/abstract_web_client.js
index c34e020a17b..34b033b8c3d 100644
--- a/addons/web/static/src/js/chrome/abstract_web_client.js
+++ b/addons/web/static/src/js/chrome/abstract_web_client.js
@@ -75,7 +75,8 @@ var AbstractWebClient = Widget.extend(KeyboardNavigationMixin, {
}
},
do_action: function (event) {
- this.do_action(event.data.action, event.data.options || {}).then(function (result) {
+ const actionProm = this.do_action(event.data.action, event.data.options || {});
+ this.menu_dp.add(actionProm).then(function (result) {
if (event.data.on_success) {
event.data.on_success(result);
}
diff --git a/addons/web/static/src/js/chrome/menu.js b/addons/web/static/src/js/chrome/menu.js
index 3c3530d49e9..4f6ba3bd5f9 100644
--- a/addons/web/static/src/js/chrome/menu.js
+++ b/addons/web/static/src/js/chrome/menu.js
@@ -46,6 +46,7 @@ var Menu = Widget.extend({
this.$menu_apps = this.$('.o_menu_apps');
this.$menu_brand_placeholder = this.$('.o_menu_brand');
this.$section_placeholder = this.$('.o_menu_sections');
+ this._updateMenuBrand();
// Navbar's menus event handlers
var on_secondary_menu_click = function (ev) {