[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 <VincentSchippefilt@users.noreply.github.com>


Co-authored-by: Mohammed Shekha <msh@openerp.com>
This commit is contained in:
Prakash Prajapati
2019-04-22 09:17:57 +00:00
committed by Mohammed Shekha
co-authored by Mohammed Shekha
parent b3aab58a59
commit 77cd665645
2 changed files with 26 additions and 0 deletions
@@ -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;
});
@@ -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: '<tree>' +
'<field name="int_field" widget="handle"/>' +
'<field name="foo"/>' +
'<field name="bar"/>' +
'</tree>',
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);