Odoo Help


How to display a python list on a selection field openerpv7

Yassine TEIMI
on 12/11/14, 3:39 PM 473 views

The title say it all, I want to display a list of values provided by a return of a method, my objectif is to have a dynamic dropdown list by using the selection field, is that possible in v7 ?



It is possible. According to the following ex. you can make the dynamic selection values.

Field as like below.

'extension': fields.selection(_extension_get, 'Document Type', required=True, size=4),

Function is as like below.

    def _extension_get(self, cr, uid, context=None):
        cr.execute('select code,name from document_directory_content_type where active')
        res = cr.fetchall()
        return res

Note : This is available on the document module.

About This Community

This platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 12/11/14, 3:39 PM
Seen: 473 times
Last updated: 3/16/15, 8:10 AM