From d801f211460cadf835087a86e8303acec3e7947c Mon Sep 17 00:00:00 2001
From: Xavier Morel <xmo@openerp.com>
Date: Wed, 5 Oct 2011 15:02:52 +0200
Subject: [PATCH] [REV] 1150, broke filter_domain in case of empty field

bzr revid: xmo@openerp.com-20111005130252-oovrpbo4a1pjavwd
---
 addons/web/static/src/js/search.js | 22 +++-------------------
 1 file changed, 3 insertions(+), 19 deletions(-)

diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js
index f019efa6df94..cf253c3d54bc 100644
--- a/addons/web/static/src/js/search.js
+++ b/addons/web/static/src/js/search.js
@@ -895,32 +895,16 @@ openerp.web.search.ManyToOneField = openerp.web.search.CharField.extend({
         }
         return this._super(defaults);
     },
-    /**
-     * m2o default domain has a different fallback method than normal char widget:
-     *
-     * * If an ``this.id`` is set on the field and the field's input value is
-     *   the same as ``this.name``, the operator is ``this.operator || =``
-     *   and the value is ``this.id``
-     * * If
-     */
-    make_domain: function (name) {
-        var value = this.$element.val();
+    make_domain: function (name, operator, value) {
         if (this.id && this.name) {
             if (value === this.name) {
-                return [[name, this.attrs.operator || '=', this.id]];
+                return [[name, '=', this.id]];
             } else {
                 delete this.id;
                 delete this.name;
             }
         }
-        if (value === null || value === '') { return; }
-        return this._super(name, this.default_operator, value);
-    },
-    /**
-     * m2o field's normal value is the id of the m2o record
-     */
-    get_value: function () {
-        return this.id || false;
+        return this._super(name, operator, value);
     }
 });
 
-- 
GitLab