Comment 6 for bug 1253052

Revision history for this message
Cedric Le Brouster(OpenFire) (cedric-lebrouster) wrote :

Hello Twinkle,

Thank you for your answer and the video.
I took some time to think about it and read more of the OpenERP code.

You say _parent_order is not meant to be used for computing parent_left attribute.
I found no documentation about this _parent_order behavior, but when I look in orm.py at _parent_store_compute(), write() and create() methods, they all make an 'order by' when computing it.
So why is that? Isn't it wasted time then?

I personally think we can be expecting well sorting of accounts in tree view. The chart of accounts is not designed for account edition.
I know we can sort accounts by code, but that only works for children of the same parent : keep in mind that _parent_order is not specific to account_account. It is also used in product_category, stock_location and res_partner_category, and possibly in custom modules. account_account is a special case in which sorting by code (almost) preserves inheritance order.
For these reasons I'll keep using the patch I made.

I really think this is a bug, of course not a major one, but still a bug.
At least you could set it as a wishlist.

Regards,

I update the joined patch :
 - add a strip() when reading _parent_order params
 - update create() method, that didn't sort new object when created with no parent (while _parent_store_compute() does)