summaryrefslogtreecommitdiff
path: root/addons/web/static
diff options
context:
space:
mode:
authorLucas Perais (lpe) <lpe@odoo.com>2019-09-03 13:30:04 +0000
committerLucas Perais (lpe) <lpe@odoo.com>2019-09-03 14:24:58 +0000
commitb7e3469931f69091e47b4c6c2ce8a83669fa7313 (patch)
treee42714710d77221b0910ef534f5d575c986488e0 /addons/web/static
parent75460e697a20505aa22b3a273d3056e0bdc75633 (diff)
[FIX] web: grouped list as grouped list as child
In grouped editable list, get rid of the groups Edit one record in the editable list In a M2O, click on search more In search's list, group by a field Expand a group in the search's list Before this commit, it crashes because the event was propagated onto the first main list After this commit, it doesn't crash and the group is expanded OPW 2064156 closes odoo/odoo#36383 Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Diffstat (limited to 'addons/web/static')
-rw-r--r--addons/web/static/src/js/views/list/list_controller.js1
-rw-r--r--addons/web/static/tests/views/list_tests.js51
2 files changed, 52 insertions, 0 deletions
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: '<tree editable="top"><field name="foo"/><field name="m2o"/></tree>',
+ groupBy: ['bar'],
+ archs: {
+ 'bar,false,list': '<tree><field name="cornichon"/></tree>',
+ 'bar,false,search': '<search><filter context="{\'group_by\': \'cornichon\'}" string="cornichon"/></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 = '<script>throw Error();</script>';