diff --git a/addons/web/static/src/js/fields/relational_fields.js b/addons/web/static/src/js/fields/relational_fields.js index ff9d6359dd1..260266ac9a9 100644 --- a/addons/web/static/src/js/fields/relational_fields.js +++ b/addons/web/static/src/js/fields/relational_fields.js @@ -1857,6 +1857,7 @@ var FieldMany2ManyTags = AbstractField.extend({ } this.colorField = this.nodeOptions.color_field; + this.hasDropdown = false; }, //-------------------------------------------------------------------------- @@ -1923,6 +1924,7 @@ var FieldMany2ManyTags = AbstractField.extend({ return { colorField: this.colorField, elements: elements, + hasDropdown: this.hasDropdown, readonly: this.mode === "readonly", }; }, @@ -2034,6 +2036,14 @@ var FormFieldMany2ManyTags = FieldMany2ManyTags.extend({ 'mousedown .o_colorpicker a': '_onUpdateColor', 'mousedown .o_colorpicker .o_hide_in_kanban': '_onUpdateColor', }), + /** + * @override + */ + init: function () { + this._super.apply(this, arguments); + + this.hasDropdown = !!this.colorField; + }, //-------------------------------------------------------------------------- // Handlers diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index 752ad974042..7ff585f37c8 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -838,11 +838,11 @@ -
+
- + diff --git a/addons/web/static/tests/fields/relational_fields_tests.js b/addons/web/static/tests/fields/relational_fields_tests.js index 316f5caeffd..640e02701c2 100644 --- a/addons/web/static/tests/fields/relational_fields_tests.js +++ b/addons/web/static/tests/fields/relational_fields_tests.js @@ -12683,6 +12683,30 @@ QUnit.module('relational_fields', { form.destroy(); }); + QUnit.test('fieldmany2many tags in tree view', function (assert) { + assert.expect(3); + + this.data.partner.records[0].timmy = [12, 14]; + var list = createView({ + View: ListView, + model: 'partner', + data: this.data, + arch: '' + + '' + + '', + }); + assert.containsN(list, '.o_field_many2manytags .badge', 2, "there should be 2 tags"); + assert.containsNone(list, '.dropdown-toggle', "the tags should not be dropdowns"); + + testUtils.intercept(list, 'switch_view', function (event) { + assert.strictEqual(event.data.view_type, "form", "should switch to form view"); + }); + // click on the tag: should do nothing and open the form view + testUtils.dom.click(list.$('.o_field_many2manytags .badge:first')); + + list.destroy(); + }); + QUnit.test('fieldmany2many tags view a domain', function (assert) { assert.expect(7);