← Back to team overview

openerp-community-reviewer team mailing list archive

[Bug 1210177] Re: openerp 7.0 read_group dont compute aggreated fields on inherits table

 

Hello,

Sorry for the response delay, this issue has been fixed in server 7.0 at
revision [1]. Have a look at the patch to see how we actually did it (it
is a bit different from your proposed patch, there were other side
effects to consider).

Thanks for reporting and working on a fix!

[1] 5220 revid:mat@xxxxxxxxxxx-20140203140247-n090tx2yf8mujkcz

** Changed in: openobject-server
   Importance: Undecided => Low

** Changed in: openobject-server
       Status: New => Fix Released

** Changed in: openobject-server
    Milestone: None => 7.0

** Changed in: openobject-server
     Assignee: (unassigned) => OpenERP's Framework R&D (openerp-dev-framework)

-- 
You received this bug notification because you are a member of OpenERP
Community Backports Team, which is subscribed to OpenERP Community
Backports (Server).
https://bugs.launchpad.net/bugs/1210177

Title:
  openerp 7.0 read_group dont compute aggreated fields on inherits table

Status in OpenERP Community Backports (Server):
  New
Status in OpenERP Community Backports (Server) 7.0 series:
  New
Status in OpenERP Server:
  Fix Released

Bug description:
  If you look in human Resources-> timesheet activities, by default we
  have a total on Duration columns, this fields come from account
  analytic line.  Sum work fine, but if you try to group by user, you
  dont have total.

  
  Problem come from osv/orm.py/BaseModel.read_group

  2 change needed to fix that

  1)
  aggregated_fields = [
              f for f in fields
              if f not in ('id', 'sequence')
              if fget[f]['type'] in ('integer', 'float')
              if (f in self._columns and getattr(self._columns[f], '_classic_write') or 
                  f in self._all_columns and getattr(self._all_columns[f].column, '_classic_write')  #LOOK IF THE FIELDS COME FROM INHERITS
                  )]

  This change will tell to openerp to take the fields in
  aggregated_fields table if he come from a inherits

  2)
  for f in aggregated_fields:
              group_operator = fget[f].get('group_operator', 'sum')
              if flist:
                  flist += ', '
                  if f in self._columns: #IF COLUMNS COME FROM TABLE, DO NORMALY
                      qualified_field = '"%s"."%s"' % (self._table, f)
                  else:
                      #IF COLUMN COME FROM A INHERITS WE NEED TO ADD __RELATION_FIELD in the table source name
                      qualified_field = '"%s__%s"."%s"' % (self._table,self._all_columns[f].parent_column, f)
              flist += "%s(%s) AS %s" % (group_operator, qualified_field, f)

  This Change will tell to openerp which columns he need to include in
  the Select query.

  With this change on our side, all work fine now !

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