diff --git a/addons/web/static/src/js/views/list/list_controller.js b/addons/web/static/src/js/views/list/list_controller.js index 524bd2034db..9fb765f8ae2 100644 --- a/addons/web/static/src/js/views/list/list_controller.js +++ b/addons/web/static/src/js/views/list/list_controller.js @@ -579,6 +579,7 @@ var ListController = BasicController.extend({ * @param {OdooEvent} event */ _onToggleGroup: function (event) { + event.stopPropagation(); this.model .toggleGroup(event.data.group.id) .then(this.update.bind(this, {}, {keepSelection: true, reload: false})); diff --git a/addons/web/static/tests/views/list_tests.js b/addons/web/static/tests/views/list_tests.js index 223aea85a93..031e691388b 100644 --- a/addons/web/static/tests/views/list_tests.js +++ b/addons/web/static/tests/views/list_tests.js @@ -3268,6 +3268,57 @@ QUnit.module('Views', { list.destroy(); }); + QUnit.test('grouped list with another grouped list parent, click unfold', function (assert) { + assert.expect(3); + this.data.bar.fields = { + cornichon: {string: 'cornichon', type: 'char'}, + }; + + var rec = this.data.bar.records[0]; + // create records to have the search more button + var newRecs = []; + for (var i=0; i<8; i++) { + var newRec = _.extend({}, rec); + newRec.id = 10 + i; + newRec.cornichon = 'extra fin'; + newRecs.push(newRec) + } + this.data.bar.records = newRecs; + + var list = createView({ + View: ListView, + model: 'foo', + data: this.data, + arch: '', + groupBy: ['bar'], + archs: { + 'bar,false,list': '', + 'bar,false,search': '', + }, + }); + + list.update({groupBy: []}); + + testUtilsDom.click(list.$('.o_data_cell:eq(0)')); + + testUtilsDom.click(list.$('.o_selected_row .o_data_cell .o_field_many2one input')); + $('.ui-autocomplete .ui-menu-item:contains("Search More")').mouseenter().click(); + + assert.containsOnce($('body'), '.modal-content'); + + assert.containsNone($('body'), '.modal-content .o_group_name', 'list in modal not grouped'); + + testUtilsDom.click($('body .modal-content button:contains(Group By)')); + + testUtilsDom.click($('body .modal-content .o_menu_item a:contains(cornichon)')); + + testUtilsDom.click($('body .modal-content .o_group_header')); + + assert.containsOnce($('body'), '.modal-content .o_group_open'); + + list.destroy(); + }); + QUnit.test('field values are escaped', function (assert) { assert.expect(1); var value = '';