[FIX] web: keep domain with search field

Currently (since commit e6a2d222d6), the domain of a search view field tag
is dropped.

This previous change was done since some of these domains refers to a
field not available in the javascript.

This fix drop the domain only if it can't be evaluated in the javascript
side.

opw-632030
This commit is contained in:
Nicolas Lempereur 2015-04-17 10:06:14 +02:00
parent 64fd1dc636
commit 2b90e054bb
1 changed files with 9 additions and 1 deletions

View File

@ -1647,9 +1647,17 @@ instance.web.search.ManyToOneField = instance.web.search.CharField.extend({
// FIXME: "concurrent" searches (multiple requests, mis-ordered responses)
var context = instance.web.pyeval.eval(
'contexts', [this.view.dataset.get_context()]);
var args = this.attrs.domain;
if(typeof args === 'string') {
try {
args = instance.web.pyeval.eval('domain', args);
} catch(e) {
args = [];
}
}
return this.model.call('name_search', [], {
name: needle,
args: (typeof this.attrs.domain === 'string') ? [] : this.attrs.domain,
args: args,
limit: 8,
context: context
}).then(function (results) {