3
0
Fork 0

[FIX] web_tree_many2one_clickable: Compatible with decoration colors

12.0
Alexandre Díaz 2020-04-21 13:06:43 +02:00
parent 7be7fd5cff
commit fe0fbf44f3
2 changed files with 17 additions and 15 deletions

View File

@ -1,15 +1,8 @@
td.o_many2one_cell {
a {
color: $o-main-text-color !important;
&:hover {
color: $o-main-text-color !important;
}
.many2one_clickable {
margin-left: 0.5em;
visibility: hidden;
}
}
&:hover a.many2one_clickable {
visibility: visible;

View File

@ -32,11 +32,13 @@ odoo.define('web_tree_many2one_clickable.many2one_clickable', function (require)
var self = this;
if (!this.noOpen && this.value) {
// Disable 'click' events
this.$el.off('click');
this.$el.on('click', function (ev) {
ev.preventDefault();
})
// Replace '<a>' element
this.$el.removeClass("o_form_uri");
this.$el = $("<span/>", {
html: this.$el.html(),
class: this.$el.attr("class") + " o_field_text",
name: this.$el.attr("name"),
});
// Append button
var $a = $('<a/>', {
@ -59,5 +61,12 @@ odoo.define('web_tree_many2one_clickable.many2one_clickable', function (require)
this.$el.append($a);
}
},
getFocusableElement: function () {
if (this.mode === 'readonly') {
return $('');
}
return this._super.apply(this, arguments);
},
});
});