[FIX]calendar tooltip attachment container
authorCedric Snauwaert <csn@openerp.com>
Wed, 23 Apr 2014 14:52:35 +0000 (16:52 +0200)
committerCedric Snauwaert <csn@openerp.com>
Wed, 23 Apr 2014 14:52:35 +0000 (16:52 +0200)
bzr revid: csn@openerp.com-20140423145235-ajph1xj2l492q1sy

addons/web/static/src/js/view_form.js

index 21a34db..247fd2d 100644 (file)
@@ -1870,11 +1870,19 @@ instance.web.form.FormWidget = instance.web.Widget.extend(instance.web.form.Invi
         widget = widget || this;
         trigger = trigger || this.$el;
         var container = 'body';
-        //in the case we have a modal currently showing, attach tooltip
-        //to the modal to prevent the tooltip to show in the body in the
-        //case we close the modal too fast
-        if (window.$('.modal.in').length>0){
-            container = window.$('.modal.in:last()');
+        /*TODO: need to be refactor
+        in the case we can find the view form in the parent, 
+        attach the element to it (to prevent tooltip to keep showing
+        when switching view) or if we have a modal currently showing,
+        attach tooltip to the modal to prevent the tooltip to show in the body in the
+        case we close the modal too fast*/
+        if ($(trigger).parents('.oe_view_manager_view_form').length > 0){
+            container = $(trigger).parents('.oe_view_manager_view_form');
+        }
+        else {
+            if (window.$('.modal.in').length>0){
+                container = window.$('.modal.in:last()');
+            }
         }
         options = _.extend({
                 delay: { show: 500, hide: 0 },