[MERGE] move filtering of non-searchable fields to prune the fields list itself

if only the *display* list is filtered, the advanced search engine may
still attempt to *select* a non-searchable field (if it's the first
one) leading to broken/nonsensical behavior. 

Non-searchable fields should be removed from the advanced search's
ability to find them altogether.

bzr revid: xmo@openerp.com-20120621101103-k842i8h1rxlr4n9k
This commit is contained in:
Xavier Morel 2012-06-21 12:11:03 +02:00
commit ace69b6921
2 changed files with 3 additions and 3 deletions

View File

@ -1227,7 +1227,8 @@ openerp.web.search.ExtendedSearchProposition = openerp.web.OldWidget.extend(/**
init: function (parent, fields) {
this._super(parent);
this.fields = _(fields).chain()
.map(function(val, key) { return _.extend({}, val, {'name': key}); })
.map(function(val, key) {return _.extend({}, val, {'name': key}); })
.filter(function(field){return typeof field.store === 'undefined' || field.store || field.fnct_search})
.sortBy(function(field) {return field.string;})
.value();
this.attrs = {_: _, fields: this.fields, selected: null};

View File

@ -1442,8 +1442,7 @@
<div t-att-id="widget.element_id">
<select class="searchview_extended_prop_field">
<t t-foreach="widget.attrs.fields" t-as="field">
<option t-if="typeof field.store === 'undefined' || field.store || field.fnct_search"
t-att="{'selected': field === widget.attrs.selected ? 'selected' : null}"
<option t-att="{'selected': field === widget.attrs.selected ? 'selected' : null}"
t-att-value="field.name">
<t t-esc="field.string"/>
</option>