[REF] web: allow override tooltip options

Before this commit, the options of the tooltip where set inline.

After this commit, the options are returned by a function.
This allow us to adapt these options in another module.

Task ID: 2152124

closes odoo/odoo#52170

Related: odoo/enterprise#10864
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
This commit is contained in:
Romeo Fragomeli
2020-05-29 13:31:31 +00:00
parent ba93b4a243
commit 16fabc8227
@@ -280,14 +280,7 @@ var BasicRenderer = AbstractRenderer.extend(WidgetAdapterMixin, {
// should be attached if not given, the tooltip is attached on the
// widget's $el
$node = $node.length ? $node : widget.$el;
$node.tooltip({
title: function () {
return qweb.render('WidgetLabel.tooltip', {
debug: config.isDebug(),
widget: widget,
});
}
});
$node.tooltip(this._getTooltipOptions(widget));
},
/**
* Does the necessary DOM updates to match the given modifiers data. The
@@ -413,6 +406,22 @@ var BasicRenderer = AbstractRenderer.extend(WidgetAdapterMixin, {
_getRecord: function (recordId) {
return null;
},
/**
* Get the options for the tooltip. This allow to change this options in another module.
* @param widget
* @return {{}}
* @private
*/
_getTooltipOptions: function (widget) {
return {
title: function () {
return qweb.render('WidgetLabel.tooltip', {
debug: config.isDebug(),
widget: widget,
});
}
};
},
/**
* @private
* @param {jQueryElement} $el