[FIX] correctly expand many2ones in autocompletion
authorGéry Debongnie <ged@odoo.com>
Thu, 18 Sep 2014 09:03:18 +0000 (11:03 +0200)
committerGéry Debongnie <ged@odoo.com>
Thu, 18 Sep 2014 09:04:01 +0000 (11:04 +0200)
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)

addons/web/static/src/js/search.js

index 3b2a544..f14b8c0 100644 (file)
@@ -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) {