Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

distinct_field_get in ORM

By
mid123
on 3/19/14, 3:18 AM 754 views

Does anybody knows about use of distinct_field_get in orm methods

0
Habib
On 5/19/15, 8:41 AM

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

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 3/19/14, 3:18 AM
Seen: 754 times
Last updated: 6/23/15, 8:42 PM