[FIX] correctly expand many2ones in autocompletion
The ManyToOneField widget evaluated the domain before doing a name_search, but the domain should not be evaluated client side, because it can only be static at that point. It caused crash in autocompletion because some variables could not be found in the context (see stage_id in project.task for example)
This commit is contained in:
@@ -1636,8 +1636,7 @@ instance.web.search.ManyToOneField = instance.web.search.CharField.extend({
|
||||
'contexts', [this.view.dataset.get_context()]);
|
||||
return this.model.call('name_search', [], {
|
||||
name: needle,
|
||||
args: instance.web.pyeval.eval(
|
||||
'domains', this.attrs.domain ? [this.attrs.domain] : [], context),
|
||||
args: (typeof this.attrs.domain === 'string') ? [] : this.attrs.domain,
|
||||
limit: 8,
|
||||
context: context
|
||||
}).then(function (results) {
|
||||
|
||||
Reference in New Issue
Block a user