[REV] 1150, broke filter_domain in case of empty field
bzr revid: xmo@openerp.com-20111005130252-oovrpbo4a1pjavwd
This commit is contained in:
parent
478854aac0
commit
d801f21146
|
@ -895,32 +895,16 @@ openerp.web.search.ManyToOneField = openerp.web.search.CharField.extend({
|
||||||
}
|
}
|
||||||
return this._super(defaults);
|
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 (this.id && this.name) {
|
||||||
if (value === this.name) {
|
if (value === this.name) {
|
||||||
return [[name, this.attrs.operator || '=', this.id]];
|
return [[name, '=', this.id]];
|
||||||
} else {
|
} else {
|
||||||
delete this.id;
|
delete this.id;
|
||||||
delete this.name;
|
delete this.name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (value === null || value === '') { return; }
|
return this._super(name, operator, value);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue