Skip to Content
Menu
This question has been flagged
1 Reply
3169 Views

How to order legal types by id with name_search() method?

I tried _order='id' but it doesn't work, it works only with _order='id desc', but I want to order ascendent by id... Can someone know how to implement name_search() method here?

Avatar
Discard
Best Answer

How about 'id asc'?

def _name_search(self, name='', args=None, operator='ilike', limit=100, name_get_uid=None):
    result_ids = self._search([], order='id asc', limit=limit, access_rights_uid=name_get_uid)
    return self.browse(result_ids).name_get()

Avatar
Discard
Related Posts Replies Views Activity
0
Jul 17
3766
2
Sep 15
8262
1
Jul 15
5858
1
Apr 23
2969
1
Mar 21
7629