/* Bootstrap defaults overwrite */
-$.fn.tooltip.Constructor.DEFAULTS.placement = 'bottom';
+$.fn.tooltip.Constructor.DEFAULTS.placement = 'auto top';
$.fn.tooltip.Constructor.DEFAULTS.html = true;
$.fn.tooltip.Constructor.DEFAULTS.container = 'body';
+//overwrite bootstrap tooltip method to fix bug when using placement
+//auto and the parent element does not exist anymore resulting in
+//an error. This should be remove once bootstrap fix the bug
+var bootstrap_show_function = $.fn.tooltip.Constructor.prototype.show;
+$.fn.tooltip.Constructor.prototype.show = function (e) {
+ if (this.$element.parent().length === 0){
+ return;
+ }
+ return bootstrap_show_function.call(this, e);
+};
/**
* Registry for all the client actions key: tag value: widget
do_attach_tooltip: function(widget, trigger, options) {
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()');
+ }
options = _.extend({
delay: { show: 500, hide: 0 },
trigger: 'hover',
+ container: container,
title: function() {
var template = widget.template + '.tooltip';
if (!QWeb.has_template(template)) {