diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 21a34db0036..247fd2d2a1a 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -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 },