From 77cd66564531e61a11c73aff54978aca0caf229e Mon Sep 17 00:00:00 2001 From: Prakash Prajapati Date: Thu, 18 Apr 2019 09:31:18 +0000 Subject: [PATCH] [IMP] web: Hide the handle widget in grouped list view when user in the group by list view it is not allow to change the sequence of items by drag & drop with the handle widget, so it does not make sense to display handle widget. After this commit handle widget will hide in grouped list view. Task-1964661 closes odoo/odoo#32855 Signed-off-by: VincentSchippefilt Co-authored-by: Mohammed Shekha --- .../static/src/js/views/list/list_renderer.js | 3 +++ addons/web/static/tests/views/list_tests.js | 23 +++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/addons/web/static/src/js/views/list/list_renderer.js b/addons/web/static/src/js/views/list/list_renderer.js index 0d04fd69585..cc1384f03be 100644 --- a/addons/web/static/src/js/views/list/list_renderer.js +++ b/addons/web/static/src/js/views/list/list_renderer.js @@ -248,6 +248,9 @@ var ListRenderer = BasicRenderer.extend({ } if (!reject && c.attrs.widget === 'handle') { self.handleField = c.attrs.name; + if (self.isGrouped) { + return true; + } } return reject; }); diff --git a/addons/web/static/tests/views/list_tests.js b/addons/web/static/tests/views/list_tests.js index 57994cb824f..bbc6cf763cf 100644 --- a/addons/web/static/tests/views/list_tests.js +++ b/addons/web/static/tests/views/list_tests.js @@ -465,6 +465,29 @@ QUnit.module('Views', { list.destroy(); }); + QUnit.test('basic grouped list rendering with widget="handle" col', async function (assert) { + assert.expect(5); + + var list = await createView({ + View: ListView, + model: 'foo', + data: this.data, + arch: '' + + '' + + '' + + '' + + '', + groupBy: ['bar'], + }); + + assert.strictEqual(list.$('th:contains(Foo)').length, 1, "should contain Foo"); + assert.strictEqual(list.$('th:contains(Bar)').length, 1, "should contain Bar"); + assert.containsN(list, 'tr.o_group_header', 2, "should have 2 .o_group_header"); + assert.containsN(list, 'th.o_group_name', 2, "should have 2 .o_group_name"); + assert.containsNone(list, 'th:contains(int_field)', "Should not have int_field in grouped list"); + list.destroy(); + }); + QUnit.test('basic grouped list rendering 1 col without selector', async function (assert) { assert.expect(2);