[IMP] web: allow invisible filters to be used
Before this rev. `invisible` filters in the search view were not considered at all. Now the filters are still invisible from the user POV, but they are still accesible via context and can be applied on search. Related of task 2036392
This commit is contained in:
committed by
Martin Geubelle
parent
3c134293b6
commit
7c95dbf366
@@ -170,6 +170,9 @@ var ControlPanelView = Factory.extend({
|
||||
DEFAULT_PERIOD;
|
||||
filter.currentOptionId = false;
|
||||
}
|
||||
if (attrs.invisible) {
|
||||
filter.invisible = true;
|
||||
}
|
||||
} else if (filter.type === 'groupBy') {
|
||||
filter.fieldName = attrs.fieldName;
|
||||
filter.fieldType = this.fields[attrs.fieldName].type;
|
||||
@@ -224,9 +227,6 @@ var ControlPanelView = Factory.extend({
|
||||
|
||||
|
||||
_.each(preFilters, function (preFilter) {
|
||||
if (preFilter.attrs && preFilter.attrs.invisible) {
|
||||
return;
|
||||
}
|
||||
if (preFilter.tag !== currentTag || _.contains(['separator', 'field'], preFilter.tag)) {
|
||||
if (currentGroup.length) {
|
||||
if (currentTag === 'groupBy') {
|
||||
|
||||
@@ -1012,8 +1012,8 @@
|
||||
<t t-if="widget.items.length !== 0">
|
||||
<t t-set="group" t-value="0"/>
|
||||
<t t-foreach="widget.items" t-as="item">
|
||||
<div t-if="group !== item.groupNumber" role="separator" class="dropdown-divider" data-removable="1"/>
|
||||
<div class="o_menu_item"
|
||||
<div t-if="group !== item.groupNumber and !item.invisible" role="separator" class="dropdown-divider" data-removable="1"/>
|
||||
<div t-attf-class="o_menu_item #{item.invisible ? 'd-none' : ''}"
|
||||
t-att-data-id="item.id">
|
||||
<a role="menuitem" href="#" t-attf-class="dropdown-item#{item.isActive ? ' selected ' : ''}">
|
||||
<t t-esc="item.description"/>
|
||||
|
||||
@@ -355,7 +355,7 @@ QUnit.module('Views', {
|
||||
});
|
||||
await 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")');
|
||||
assert.containsOnce(controlPanel, '.o_menu_item.d-none a:contains("B")');
|
||||
|
||||
controlPanel.destroy();
|
||||
});
|
||||
@@ -413,7 +413,7 @@ QUnit.module('Views', {
|
||||
});
|
||||
await 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")');
|
||||
assert.containsOnce(controlPanel, '.o_menu_item.d-none a:contains("B")');
|
||||
|
||||
controlPanel.destroy();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user