Skip to content

Commit

Permalink
[FIX] base, web, website: settings - prevent duplicate enterprise labels
Browse files Browse the repository at this point in the history
Before this commit:
Multiple widgets for the same field on the same view (V11.0 settings) would not
retrieve the correct label but all of them.

Now:
We now retrieve the correct label instead of all of them
  • Loading branch information
rdeodoo committed Oct 20, 2017
1 parent 823cfd6 commit dd2a619
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions addons/web/static/src/js/views/form/form_renderer.js
Expand Up @@ -811,7 +811,15 @@ var FormRenderer = BasicRenderer.extend({
// Attach the tooltips on the fields' label
_.each(this.allFieldWidgets[this.state.id], function (widget) {
var idForLabel = self.idsForLabels[widget.name];
// We usually don't support multiple widgets for the same field on the
// same view but it is the case with the new settings view on V11.0.
// Therefore, we need to retrieve the correct label since it could be
// displayed multiple times on the view, otherwise, for example the
// enterprise label will be displayed as many times as the field
// exists on settings.
var $widgets = self.$('.o_field_widget[name=' + widget.name + ']');
var $label = idForLabel ? self.$('label[for=' + idForLabel + ']') : $();
$label = $label.eq($widgets.index(widget.$el));
if (config.debug || widget.attrs.help || widget.field.help) {
self._addFieldTooltip(widget, $label);
}
Expand Down

0 comments on commit dd2a619

Please sign in to comment.