Add methods to browse_list

Asked by Cristian Salamea

Hello my question is about add methods to browse list when i browse an IDs list. i want to read records order by ome field.

So browse_record_list is the right place to do it ?

Regards,

Question information

Language:
English Edit question
Status:
Solved
For:
Odoo Server (MOVED TO GITHUB) Edit question
Assignee:
No assignee Edit question
Solved by:
Guewen Baconnier @ Camptocamp
Solved:
Last query:
Last reply:
Revision history for this message
Best Guewen Baconnier @ Camptocamp (gbaconnier-c2c) said :
#1

I think the obvious way to sort a list of browse records would be:

from operator import attrgetter
[...]
sorted_records = sorted(records, key=attrgetter('sort_field1', 'sort_field2'))

Revision history for this message
Cristian Salamea (ovnicraft) said :
#2

Hi Guewen, yes i am doing in python way but what about browse objects and get filtered ?
My question goes to improve browse_list with more functions and made dev tasks easy.

MyObjList.count() instead len(MyObjList)
MyObjList.order(['field desc|asc',..,])
MyObjList.filter(field=regexp)

I am doing some changes but i wantto know if browse_list is the right class to do it.

Regards,

Revision history for this message
Cristian Salamea (ovnicraft) said :
#3

Thanks Guewen Baconnier @ Camptocamp, that solved my question.

Revision history for this message
Ferdinand (office-chricar) said :
#4