From 9b9a5034ad5ece5fede6e326f44ac5f870c8e5a6 Mon Sep 17 00:00:00 2001 From: ilvalle Date: Wed, 3 Sep 2014 19:28:16 +0200 Subject: [PATCH] fix grid groupby with more than 2 Fields in the expression --- gluon/sqlhtml.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gluon/sqlhtml.py b/gluon/sqlhtml.py index 5254db55..98ff1031 100644 --- a/gluon/sqlhtml.py +++ b/gluon/sqlhtml.py @@ -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):