Odoo Help


Where does Odoo store allowed selection field values?

Timo Talvitie, Vizucom Oy
on 9/2/14, 3:46 AM 1,273 views

I'd like to know how Odoo keeps track of allowed dropdown values (for example, values for the priority field in project.task). Is it possible to view and add them dynamically via ORM or a regular SQL query?

Javier Matos Odut
On 9/2/14, 4:03 AM

Hello Timo,

For that I use to create a many2one field in the model pointing to a new model whose instances are the values that I want to allow.

Let's say that you have a partner and you want to add a select input whose values can be dinamically generated. Then you can create the following field into the res.partner:

'x_partner_type_id': fields.many2one(
    'Partner Type',

Then, you will have to create the model mycompany.customer.type where you will have all the choices:

from openerp.osv import fields, osv

class customer_type(osv.Model):
    _name = 'mycompany.customer.type'
    _columns = {
        'name': fields.char('Name', size=64, required=True),
        'description': fields.text('Description'),


And that's it. Now you have a field in your partner whose values are generated dinamically by using your view (you have to add x_partner_type_id into partner's view).

Thanks Javier, but the fields already exist in Odoo's core as selection lists. Converting them to many2ones may be an option, but before attempting that I'd like to try if reading/adding list values programmatically works. In the project_task postgres table 'priority' is a regular varchar column, so Odoo keeps track of the allowed values somewhere else, but I haven't figured out where.

Vizucom Oy, Timo Talvitie, Vizucom Oy
on 9/2/14, 4:50 AM

You can try to redefine the field that you want to change to allow additional values (take base values, and add additional ones). I think that choices for a select field are hardcoded into .py files, and Odoo does not use db for those values.

Javier Matos Odut
on 9/2/14, 4:59 AM

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: 9/2/14, 3:46 AM
Seen: 1273 times
Last updated: 3/16/15, 8:10 AM