[FIX] web_widget_domain_v11: Allow to change operator

Previously, a Bootstrap dropdown was being used to choose the domain operator.

It was not working due to a problem that doesn't allow to have nested dropdowns in Odoo 10.0 search views, but possibly yes in the intermediate version where this addon was backported.

To get this working, the BS dropdown is replaced by a standard select element, so no more conflicts.
pull/763/head
Jairo Llopis 2017-10-19 14:01:27 +02:00
parent b1f0cf0df2
commit 05381660f7
3 changed files with 7 additions and 16 deletions

View File

@ -9,10 +9,6 @@
} }
&.o_domain_tree { &.o_domain_tree {
.o_domain_tree_operator_caret::after {
.o-caret-down();
}
> .o_domain_node_children_container { > .o_domain_node_children_container {
padding-left: @o-domain-selector-indent; padding-left: @o-domain-selector-indent;

View File

@ -84,10 +84,10 @@ var DomainNode = Widget.extend({
var DomainTree = DomainNode.extend({ var DomainTree = DomainNode.extend({
template: "DomainTree", template: "DomainTree",
events: _.extend({}, DomainNode.prototype.events, { events: _.extend({}, DomainNode.prototype.events, {
"click .o_domain_tree_operator_selector > ul > li > a": function (e) { "change .o_domain_tree_operator_selector": function (e) {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
this.changeOperator($(e.target).data("operator")); this.changeOperator($(e.target).val());
}, },
}), }),
custom_events: { custom_events: {

View File

@ -26,16 +26,11 @@
</div> </div>
</t> </t>
<t t-name="DomainTree.OperatorSelector"> <t t-name="DomainTree.OperatorSelector">
<div t-if="!widget.readonly" class="btn-group o_domain_tree_operator_selector"> <div t-if="!widget.readonly" class="btn-group">
<button class="btn btn-xs btn-primary o_domain_tree_operator_caret" data-toggle="dropdown"> <select class="o_domain_tree_operator_selector">
<t t-if="widget.operator === '&amp;'">All</t> <option value="&amp;" t-att-selected="widget.operator === '&amp;' ? 'selected' : null">All</option>
<t t-if="widget.operator === '|'">Any</t> <option value="|" t-att-selected="widget.operator === '|' ? 'selected' : null">Any</option>
<t t-if="widget.operator === '!'">None</t> </select>
</button>
<ul class="dropdown-menu">
<li><a href="#" data-operator="&amp;">All</a></li>
<li><a href="#" data-operator="|">Any</a></li>
</ul>
</div> </div>
<strong t-else=""> <strong t-else="">
<t t-if="widget.operator === '&amp;'">ALL</t> <t t-if="widget.operator === '&amp;'">ALL</t>