[IMP] web: remove 'ID' field from custom groupby dropdown

purpose of this commit is to remove ID from the fields to group by on the
searchview as it does not work nor does it make sense.

removed field 'ID' from custom group by on search view.

task-2028105

closes odoo/odoo#34752

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit is contained in:
Priyanka Kakadiya
2019-08-28 08:43:03 +00:00
parent 9a4123995f
commit 5f35819fff
2 changed files with 21 additions and 1 deletions
@@ -39,7 +39,7 @@ var GroupByMenu = DropdownMenu.extend({
// determines list of options used by groupBys of type 'date'
this.groupableFields = [];
_.each(fields, function (field, name) {
if (field.sortable && _.contains(GROUPABLE_TYPES, field.type)) {
if (field.sortable && name !== "id" && _.contains(GROUPABLE_TYPES, field.type)) {
self.groupableFields.push(_.extend({}, field, {
name: name,
}));
@@ -176,5 +176,25 @@ QUnit.module('GroupByMenu', {
groupByMenu.destroy();
});
QUnit.test('custom group by dropdown should not have ID field', async function (assert) {
assert.expect(2);
this.fields.id = {sortable: true, string: 'ID', type: 'integer'};
var groupByMenu = await createGroupByMenu([], this.fields);
// open groupBy menu
await testUtils.dom.click(groupByMenu.$('button:first'));
// open Add Custom Group submenu
await testUtils.dom.click(groupByMenu.$('.o_add_custom_group'))
assert.containsOnce(groupByMenu, '.o_group_selector option',
'groupby menu should have only one option');
// custom group by should not have 'ID' field
assert.containsNone(groupByMenu, '.o_group_selector option[value="id"]',
'id field should not be in custom group by');
groupByMenu.destroy();
});
});
});