From f889d3af82011be115f8e384130d25426482e772 Mon Sep 17 00:00:00 2001 From: Khoi Nguyen Date: Wed, 19 Jul 2017 10:22:41 +0200 Subject: [PATCH] [FIX] web: prevent traceback when double-clicking links in modals Before this revision, double-clicking links in a modal triggered a traceback. This is because the second click attempts to change the active view while it is still being changed by the first click (more precisely, the controller of the active view is undefined on the second click). This commit ensures that on_attach_callback is called only if the controller is defined. Steps to reproduce the issue fixed by this commit: 1. Open a sales order; 2. Click on a product line; 3. Double-click on the product. --- addons/web/static/src/js/chrome/view_manager.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/js/chrome/view_manager.js b/addons/web/static/src/js/chrome/view_manager.js index b6208df272d..ebd063d7360 100644 --- a/addons/web/static/src/js/chrome/view_manager.js +++ b/addons/web/static/src/js/chrome/view_manager.js @@ -53,7 +53,8 @@ var ViewManager = Widget.extend(ControlPanelMixin, { */ on_attach_callback: function() { this.is_in_DOM = true; - if (this.active_view && this.active_view.controller.on_attach_callback) { + var controller = this.active_view && this.active_view.controller; + if (controller && this.active_view.controller.on_attach_callback) { this.active_view.controller.on_attach_callback(); } },