diff options
| author | Géry Debongnie <ged@odoo.com> | 2018-12-11 13:51:04 +0000 |
|---|---|---|
| committer | Christophe Monniez <moc@odoo.com> | 2019-01-06 16:54:29 +0000 |
| commit | 68eefe3ceece70919cb03c77ec187f7b84ece172 (patch) | |
| tree | b2101b2eda56dfd56ebf8d0a943df5736cf0be10 /addons/web/static/tests/views | |
| parent | 70f35620babdfdf43e2c603efbf37f2cf7399240 (diff) | |
[FIX] web: do not render invisible filters in search view
In some cases, the web client may receive a search view with invisible
filters. This is due to the way field_view_get works. For
example, if there is a group on a filter, then this will be transformed
into an invisible attribute.
In that case, the search view should simply ignore the filter and not
display it. This was broken in the recent control panel refactoring
(note that the search view lacked the possibility of testing that kind
of situation).
closes odoo/odoo#29430
cherry-pick of 13aae100e2bc0589e2313fd4105b39c0eeea4db0
closes odoo/odoo#29965
Diffstat (limited to 'addons/web/static/tests/views')
| -rw-r--r-- | addons/web/static/tests/views/control_panel_tests.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/addons/web/static/tests/views/control_panel_tests.js b/addons/web/static/tests/views/control_panel_tests.js index 513cdb32e08..08cc1391719 100644 --- a/addons/web/static/tests/views/control_panel_tests.js +++ b/addons/web/static/tests/views/control_panel_tests.js @@ -330,5 +330,28 @@ QUnit.module('Views', { "there should be two groups of a single field" ); }); + + QUnit.module('Control Panel Rendering'); + + QUnit.test('invisible filters are not rendered', async function (assert) { + assert.expect(2); + var controlPanel = await createControlPanel({ + model: 'partner', + arch: "<search>" + + "<filter name=\"filterA\" string=\"A\" domain=\"[]\"/>" + + "<filter name=\"filterB\" string=\"B\" invisible=\"1\" domain=\"[]\"/>" + + "</search>", + data: this.data, + searchMenuTypes: ['filter'], + context: { + search_disable_custom_filters: true, + }, + }); + testUtils.dom.click(controlPanel.$('.o_filters_menu_button')); + assert.containsOnce(controlPanel, '.o_menu_item a:contains("A")'); + assert.containsNone(controlPanel, '.o_menu_item a:contains("B")'); + + controlPanel.destroy(); + }); }); }); |
