[FIX] web: date filter options unselected after facet deletion

Select the option 'This Month' of a date filter
in the filter menu and then remove the facet created
correctly toggles the filter from the query but the
option is still shown as selected. This commit fixes
that situation.

closes odoo/odoo#35340

Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
This commit is contained in:
Mathieu Duckerts-Antoine
2019-07-31 12:35:48 +00:00
parent cfe2ee9341
commit 1631c9dbc9
2 changed files with 18 additions and 2 deletions
@@ -157,6 +157,9 @@ var ControlPanelModel = mvc.Model.extend({
if (filter.autoCompleteValues) {
filter.autoCompleteValues = [];
}
if (filter.currentOptionId) {
filter.currentOptionId = false;
}
});
// TODO: use toggleFilter here
group.activeFilterIds = [];
@@ -981,8 +981,8 @@ QUnit.module('Search View', {
QUnit.module('Autocompletion');
QUnit.test('selection via autocompletion modifies appropriately submenus', async function (assert) {
assert.expect(4);
QUnit.test('selection via autocompletion and deletion modifies appropriately submenus', async function (assert) {
assert.expect(6);
var actionManager = await createActionManager({
actions: this.actions,
@@ -1014,6 +1014,19 @@ QUnit.module('Search View', {
assert.strictEqual($('.o_group_by_menu .o_item_option a.selected').text().trim(), "Day",
"The item 'Day' should be selected in the groupby menu");
await testUtils.dom.click($('div .o_searchview_facet .o_facet_remove').eq(0));
await testUtils.dom.click($('div .o_searchview_facet .o_facet_remove').eq(0));
await testUtils.dom.click($('button .fa-filter'));
await testUtils.dom.click($('.o_filters_menu .o_menu_item').eq(0));
assert.containsNone($('.o_filters_menu .o_item_option a.selected'),
"The item 'This Month' should have unselected in the filters menu");
await testUtils.dom.click($('button .fa-bars'));
await testUtils.dom.click($('.o_group_by_menu .o_menu_item').eq(0));
assert.containsNone($('.o_group_by_menu .o_item_option a.selected'),
"The item 'Day' should have been unselected in the groupby menu");
actionManager.destroy();
});