[FIX] broken inference of groupby groups in search view filters

Before the valpocalypse, filter contexts were "literal" (parsed
objects) when reaching the search view, and `.attrs.context.group_by`
would return the right thing (namely the group_by attribute of the
context object).

After the valpocalypse, contexts & domains on view fields (and
filters) are not evaluated on the Python side anymore and reach view
objects as strings, the access chain above thus always returns a falsy
value (undefined) as strings don't have a .group_by.

Fix FilterGroup to correctly parse filter's @context before trying to
see if it has a group_by.

lp bug: https://launchpad.net/bugs/1116432 fixed

bzr revid: xmo@openerp.com-20130307124222-1ypzfopbktxmad4z
This commit is contained in:
Xavier Morel 2013-03-07 13:42:22 +01:00
parent 1e5a3aa787
commit 617c03a19c
1 changed files with 3 additions and 1 deletions

View File

@ -1020,7 +1020,9 @@ instance.web.search.FilterGroup = instance.web.search.Input.extend(/** @lends in
// create a GroupbyGroup instead of the current FilterGroup
if (!(this instanceof instance.web.search.GroupbyGroup) &&
_(filters).all(function (f) {
return f.attrs.context && f.attrs.context.group_by; })) {
if (!f.attrs.context) { return false; }
var c = instance.web.pyeval.eval('context', f.attrs.context);
return !_.isEmpty(c.group_by);})) {
return new instance.web.search.GroupbyGroup(filters, parent);
}
this._super(parent);