Filter leaf domain of Reference fields

The domain of Reference fields must be filtered out for non-valid target
because the localization will remove the target part and thus generate an
invalid domain for the specific target.

issue4680
review11141003
This commit is contained in:
Cédric Krier committed 2015-03-30 22:37:52 +02:00
1 parent e2e6a9c004
commit e8e6fecc2d
2 files changed
+29

No files matched your search

+16
View File
@@ -1733,6 +1733,22 @@
return domain.map(this.inverse_leaf.bind(this));
}
},
filter_leaf: function(domain, field, model) {
if (~['AND', 'OR'].indexOf(domain)) {
return domain;
} else if (this.is_leaf(domain)) {
if (domain[0].startsWith(field) && (domain.length > 3)) {
if (domain[3] !== model) {
return ['id', '=', null];
}
}
return domain;
} else {
return domain.map(function(d) {
return this.filter_leaf(d, field, model);
}.bind(this));
}
},
eval_domain: function(domain, context, boolop) {
if (boolop === undefined) {
boolop = this.and;