From 907c62f0ca1efd7f63733537e55cb4d7b85bd56f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Fri, 30 Jan 2015 16:24:51 +0100 Subject: [PATCH] [FIX] web: correctly initialize view $containers Problem could happen when clicking in views in dashboards. The $container was looked up depth first when the view is created, but in some case, it is wrong (the correct order is actually breadth first). A better way to proceed is to get the reference when the view manager is created, so we don't have the problem at all. --- addons/web/static/src/js/views.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index 3399a98af9f..e4a577321e7 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -630,6 +630,7 @@ instance.web.ViewManager = instance.web.Widget.extend({ action : self.action, action_views_ids : views_ids, }, self.flags, self.flags[view.type], view.options); + view.$container = self.$(".oe-view-manager-view-" + view.type); // show options.$buttons as views will put their $buttons inside it // and call show/hide on them view.options.$buttons.show(); @@ -743,7 +744,7 @@ instance.web.ViewManager = instance.web.Widget.extend({ options.initial_mode = 'edit'; } var controller = new View(this, this.dataset, view.view_id, options), - $container = this.$(".oe-view-manager-view-" + view.type + ":first"); + $container = view.$container; $container.hide(); view.controller = controller;