Merge pull request #487 from ilvalle/grid-fix

fix grid groupby with more than 2 Fields in the expression
This commit is contained in:
mdipierro
2014-09-04 22:04:05 -05:00

View File

@@ -2111,6 +2111,8 @@ class SQLFORM(FORM):
field_id = groupby #take the field passed as groupby
elif groupby and isinstance(groupby, Expression):
field_id = groupby.first #take the first groupby field
while not(isinstance(field_id, Field)): # Navigate to the first Field of the expression
field_id = field_id.first
table = field_id.table
tablename = table._tablename
if not any(str(f) == str(field_id) for f in fields):