Merge lp://staging/~credativ/ocb-server/7.0-lp1166886 into lp://staging/ocb-server

Proposed by Craig Gowing (credativ)
Status: Rejected
Rejected by: Holger Brunn (Therp)
Proposed branch: lp://staging/~credativ/ocb-server/7.0-lp1166886
Merge into: lp://staging/ocb-server
Diff against target: 41 lines (+6/-0)
2 files modified
openerp/osv/fields.py (+5/-0)
openerp/osv/orm.py (+1/-0)
To merge this branch: bzr merge lp://staging/~credativ/ocb-server/7.0-lp1166886
Reviewer Review Type Date Requested Status
Holger Brunn (Therp) Disapprove
Olivier Dony (Odoo) (community) surface scan, no test Needs Information
Review via email: mp+182853@code.staging.launchpad.net
To post a comment you must log in.
5075. By Craig Gowing (credativ)

[IMP] Additional parameter on fields which allow aggreation to be disabled

Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

I understand it would sometimes be useful to disable the default aggregation mechanism for some columns, however I have some objections to this MP:

1. This is an API change targeted at 7.0, and one for a very wishlist behavior. I think this really belongs to trunk. For 7.0 there are some possible workarounds:
  - use a `group_operator` that gives a more acceptable behavior, such as `min`, `count` or perhaps `NULL*count` that would always render as 0.0.
  - if that's still not good enough, write a small helper function that returns a special read_group() function that drops the relevant column(s) from the result given by the super() call. Assign this special function as the read_group() method in models that need it.

2. If we intend to improve the API in trunk to support a finer-grained control on aggregation, we should use this opportunity to improve the design further and really delegate the aggregation decision to the fields themselves, instead of mostly hardwiring it in read_group(). This should only be a small variation to your patch, so if it seems acceptable to you, you could update your branch and resubmit it for trunk.

Apart from the above, does your patch actually work in its current state? (I did not test) It seems read_group() is accessing an 'allow_aggregation' item that fields_get() never returns, which should cause KeyErrors for any column except id/sequence?

Thanks!

review: Needs Information (surface scan, no test)
Revision history for this message
Holger Brunn (Therp) (hbrunn) wrote :

Thanks a lot for this, but I think Olivier raises very valid points here. Anyway, ocb is not meant for feature extensions on such a scale, so I disapprove (for this proposal against this branch).
The read_group trickery Olivier mentions worked very well for me when I needed it.

But I would love to see you following along the lines he proposes in 2., this is a very useful improvement in my opinion!

review: Disapprove
Revision history for this message
Holger Brunn (Therp) (hbrunn) wrote :

setting to rejected as no further discussion evolved here

Unmerged revisions

5075. By Craig Gowing (credativ)

[IMP] Additional parameter on fields which allow aggreation to be disabled

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches

to status/vote changes: