From 01d7077bddbf12d430378fa85542f9c04fd11acc Mon Sep 17 00:00:00 2001 From: Julien Mougenot Date: Mon, 9 Sep 2019 11:05:46 +0000 Subject: [FIX] web: readonly many2one in list views Fixes the way many2one fields are rendered in editable list views. Before this commit, many2ones in readonly mode would render as links and their widget would be considered as active even though you couldn't edit it. Now, they are rendered as plain text and act the same way as readonly char fields. --- addons/web/static/src/js/fields/relational_fields.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'addons/web/static/src/js/fields/relational_fields.js') diff --git a/addons/web/static/src/js/fields/relational_fields.js b/addons/web/static/src/js/fields/relational_fields.js index 8155f9d56f1..5efaa2c8468 100644 --- a/addons/web/static/src/js/fields/relational_fields.js +++ b/addons/web/static/src/js/fields/relational_fields.js @@ -766,6 +766,25 @@ var FieldMany2One = AbstractField.extend({ }); var ListFieldMany2One = FieldMany2One.extend({ + events: _.extend({}, FieldMany2One.prototype.events, { + 'focusin input': '_onInputFocusin', + }), + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + /** + * If in readonly, will never be considered as an active widget. + * + * @override + */ + activate: function () { + if (this.mode === 'readonly') { + return false; + } + return this._super.apply(this, arguments); + }, //-------------------------------------------------------------------------- // Private -- cgit v1.2.3