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

Does anybody knows about use of distinct_field_get in orm methods

Avatar
Discard
Best Answer

In odoo 8, I use it as follows:

def getUniqueFieldValues(self): 
ModelABC = http.request.env['module_name.modelabc']
unique_values = ModelABC.distinct_field_get(field='field_name', value='')
return sorted(set(unique_values))

The python sorted(set()) function will sort and remove duplicates

Avatar
Discard
Related Posts Replies Views Activity
2
Sep 23
6393
2
Mar 23
44268
2
Dec 23
54318
0
Mar 22
1026
3
Jun 20
9172