← Back to team overview

openerp-india team mailing list archive

[Bug 1007703] Re: Can't "group by" the "integer" field

 

To fixed it:

--- D:\OpenERP\Server\openerp-server-6.1\openerp\osv\orm_bak.py	2012-08-27 11:39:26.000000000 +0800
+++ D:\OpenERP\Server\openerp-server-6.1\openerp\osv\orm.py	2012-08-27 11:39:20.000000000 +0800
@@ -2564,12 +2564,14 @@
         data = self.read(cr, uid, data_ids, groupby and [groupby] or ['id'], context=context)
         # restore order of the search as read() uses the default _order (this is only for groups, so the size of data_read shoud be small):
         data.sort(lambda x,y: cmp(data_ids.index(x['id']), data_ids.index(y['id'])))
 
         for d in data:
             if groupby:
+                if alldata[d['id']][groupby]:
+                    alldata[d['id']][groupby] = d[groupby]
                 d['__domain'] = [(groupby, '=', alldata[d['id']][groupby] or False)] + domain
                 if not isinstance(groupby_list, (str, unicode)):
                     if groupby or not context.get('group_by_no_leaf', False):
                         d['__context'] = {'group_by': groupby_list[1:]}
             if groupby and groupby in fget:
                 if d[groupby] and fget[groupby]['type'] in ('date', 'datetime'):

-- 
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Server.
https://bugs.launchpad.net/bugs/1007703

Title:
  Can't "group by" the "integer" field

Status in OpenERP Server:
  Confirmed

Bug description:
  In my test model, I defined a integer field, and in "search view" xml,
  I put it in "Group By ..." selection..

  But, It's not work fine....
  What's wrong with it?

  and I caputre the HTTP package

  I found 
  the /res/group/read  json result is:

  {"jsonrpc": "2.0", "id": "r148", "result": [{"week": 22, "__context":
  {"group_by": []}, "week_count": 70, "__domain": [["week", "=",
  1542L]]}, {"week": 23, "__context": {"group_by": []}, "week_count":
  105, "__domain": [["week", "=", 3824L]]}]}

  
  I think the corect result is:

  {"jsonrpc": "2.0", "id": "r148", "result": [{"week": 22, "__context":
  {"group_by": []}, "week_count": 70, "__domain": [["week", "=", 22]]},
  {"week": 23, "__context": {"group_by": []}, "week_count": 105,
  "__domain": [["week", "=", 23]]}]}

  
  and the "1542L" is the sum of "week" integer field.  Not the field's ID...

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-server/+bug/1007703/+subscriptions


References