[FIX] incorrect handling of present-but-empty contexts, which seem to be rather common

bzr revid: xmo@openerp.com-20120627095744-ijhf7p769pw4fqdg
This commit is contained in:
Xavier Morel 2012-06-27 11:57:44 +02:00
parent 1f84b7a37d
commit 7b0bef5bcc
1 changed files with 2 additions and 2 deletions

View File

@ -1234,7 +1234,7 @@ instance.web.search.Field = instance.web.search.Input.extend( /** @lends instanc
var self = this;
// A field needs a context to send when active
var context = this.attrs.context;
if (!context || !facet.values.length) {
if (_.isEmpty(context) || !facet.values.length) {
return;
}
var contexts = facet.values.map(function (facetValue) {
@ -1533,7 +1533,7 @@ instance.web.search.ManyToOneField = instance.web.search.CharField.extend({
},
get_context: function (facet) {
var values = facet.values;
if (!this.attrs.context && values.length === 1) {
if (_.isEmpty(this.attrs.context) && values.length === 1) {
var c = {};
c['default_' + this.attrs.name] = values.at(0).get('value');
return c;