← Back to team overview

c2c-oerpscenario team mailing list archive

Re: [Bug 669555] Re: [6.0RC1] - default sort order missing for many objects

 

On Tuesday 02 November 2010, you wrote:
> You are right, account journal and tax codes must be sorted.
> 
> I just saw that it can not be a generic rule ...
> Ferdinand @ ChriCar wrote:
> > I am sorry this is not user friendly at all.
> > ..


Before you set the orm._order member of all objects, I'd like to draw your 
attention to one technical detail: unnecessary sorting may decrease the 
performance[1] of openerp.
Say, we have a code like:
     ids = foobar.search(cr, uid, [('name', '=', 'foo')])
     for fb in foobar.browse(cr, uid, ids):
         sumf += fb.value

There, the result would be the same if the "ids" are sorted or not. And I 
think there is many snippets like this code all around openerp.

@Ferdinard: you are true, it is rarely desirable for a user to see a randomly-
ordered result in the GUI. Note, however, that you are concerned about the 
_presentation_ layer, not necessarily all the internal processing of data 
records.

I guess we could follow one of the following tricks:
  - set the "order" or default order at the presentation layer (eg. tree 
views) and not the orm layer, in such cases
 - define an api expression of "no order" so that snippets like the above can 
explicitly avoid the sql sorting. Note that "search(..., order=False)" won't 
do, because False is the only negative value that can be sent through RPC; we 
might need to have something clever like "order=[]" .

[1] one sort operation may be of little overhead (done in C), but if 
repetitive python loops keep entering code like the above, we end up 
performing this operation many times, wasting time.

-- 
[6.0RC1] - default sort order missing for many objects
https://bugs.launchpad.net/bugs/669555
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.

Status in OpenObject Addons Modules: Invalid

Bug description:
in addons
find . -follow -name "*py" |xargs egrep 'osv\.osv| _order|_inherit'|less

IMHO each class should have either _inherit or _order to return a user friendly ordered list - especially in respect to the number of records displayed - to avoid order by id





References