summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/fields
diff options
context:
space:
mode:
authorJulien Mougenot <jum@odoo.com>2019-09-09 11:05:46 +0000
committerAaron Bohy <aab@odoo.com>2019-09-18 11:31:43 +0000
commit6a50a125f07a7bec1e45c0b71e8e7438d02b4afa (patch)
tree96e26a2d883b5d9b2660c3a33cbdc3640032656a /addons/web/static/src/js/fields
parentf15c0699062ad41a325fb94a1862502f36d21a7d (diff)
[FIX] web: readonly many2one in list views
Let's assume an editable list with a many2one and a char, the many2one being readonly. Before this rev., if the user clicked on the many2one, the row was switched in edit more, and the many2one link was given the focus. Now, in the same scenario, the focus is given to the char field which can be edited (i.e. its input). Task 2068280
Diffstat (limited to 'addons/web/static/src/js/fields')
-rw-r--r--addons/web/static/src/js/fields/relational_fields.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/addons/web/static/src/js/fields/relational_fields.js b/addons/web/static/src/js/fields/relational_fields.js
index b2d3379aef1..f713342c240 100644
--- a/addons/web/static/src/js/fields/relational_fields.js
+++ b/addons/web/static/src/js/fields/relational_fields.js
@@ -822,6 +822,22 @@ var Many2oneBarcode = FieldMany2One.extend({
var ListFieldMany2One = FieldMany2One.extend({
//--------------------------------------------------------------------------
+ // 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
//--------------------------------------------------------------------------