[FIX] group_by_full
authorChristophe Simonis <chs@openerp.com>
Tue, 15 Nov 2011 15:53:55 +0000 (16:53 +0100)
committerChristophe Simonis <chs@openerp.com>
Tue, 15 Nov 2011 15:53:55 +0000 (16:53 +0100)
bzr revid: chs@openerp.com-20111115155355-s7j3s27i2hl7xi11

openerp/osv/orm.py

index 6c4ac13..9a50cf8 100644 (file)
@@ -2478,12 +2478,12 @@ class BaseModel(object):
             del d['id']
 
         if groupby and groupby in self._group_by_full:
-            gids = map(lambda x: x[groupby][0], data)
+            gids = [x[groupby][0] for x in data if x[groupby]]
             stages = self._group_by_full[groupby](self, cr, uid, gids, domain, context)
             # as both lists are sorted in the same way, we can merge in one pass
             pos = 0
             while stages and ((pos<len(data)) or (pos<len(stages))):
-                if (pos<len(data)) and (data[pos][groupby][0] == stages[pos][0]):
+                if (pos<len(data)) and (not data[pos][groupby] or (data[pos][groupby][0] == stages[pos][0])):
                     pos+=1
                     continue
                 val = dict.fromkeys(float_int_fields, False)