From fe0fbf44f37d83de4ad28d44b07da60533ab1482 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20D=C3=ADaz?= Date: Tue, 21 Apr 2020 13:06:43 +0200 Subject: [PATCH] [FIX] web_tree_many2one_clickable: Compatible with decoration colors --- .../src/css/web_tree_many2one_clickable.scss | 13 +++---------- .../src/js/web_tree_many2one_clickable.js | 19 ++++++++++++++----- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/web_tree_many2one_clickable/static/src/css/web_tree_many2one_clickable.scss b/web_tree_many2one_clickable/static/src/css/web_tree_many2one_clickable.scss index 720183aeb..cf1240313 100644 --- a/web_tree_many2one_clickable/static/src/css/web_tree_many2one_clickable.scss +++ b/web_tree_many2one_clickable/static/src/css/web_tree_many2one_clickable.scss @@ -1,14 +1,7 @@ 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; - } + .many2one_clickable { + margin-left: 0.5em; + visibility: hidden; } &:hover a.many2one_clickable { diff --git a/web_tree_many2one_clickable/static/src/js/web_tree_many2one_clickable.js b/web_tree_many2one_clickable/static/src/js/web_tree_many2one_clickable.js index b201901b3..a1c8269be 100644 --- a/web_tree_many2one_clickable/static/src/js/web_tree_many2one_clickable.js +++ b/web_tree_many2one_clickable/static/src/js/web_tree_many2one_clickable.js @@ -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 '' element + this.$el.removeClass("o_form_uri"); + this.$el = $("", { + html: this.$el.html(), + class: this.$el.attr("class") + " o_field_text", + name: this.$el.attr("name"), + }); // Append button var $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); + }, }); });