summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorXavier Morel <xmo@openerp.com>2011-10-05 12:57:31 +0200
committerXavier Morel <xmo@openerp.com>2011-10-05 12:57:31 +0200
commit68cd9188b988176cf531cd7824afdb70f22c19d9 (patch)
tree3af110dec2ae178b68cbc7bd3e6f7085a7c992e8 /addons/web/static/src
parent19b7493711b15af850c59fae2cbc64fa364c3f1e (diff)
[FIX] handling of value and default domain in search m2o
bzr revid: xmo@openerp.com-20111005105731-9431uvhay91bt10c
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/search.js22
1 files changed, 19 insertions, 3 deletions
diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js
index cf253c3d54b..f019efa6df9 100644
--- a/addons/web/static/src/js/search.js
+++ b/addons/web/static/src/js/search.js
@@ -895,16 +895,32 @@ openerp.web.search.ManyToOneField = openerp.web.search.CharField.extend({
}
return this._super(defaults);
},
- make_domain: function (name, operator, value) {
+ /**
+ * 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();
if (this.id && this.name) {
if (value === this.name) {
- return [[name, '=', this.id]];
+ return [[name, this.attrs.operator || '=', this.id]];
} else {
delete this.id;
delete this.name;
}
}
- return this._super(name, operator, value);
+ 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;
}
});