Odoo Help


add extra options to selection field using inheritance? [Closed]

on 2/27/14, 2:41 PM 3,138 views

The Question has been closed

Sudhir Arya (ERP Harbor Consulting Services)
on 02/28/2014 03:44:46

Hello everyone, does anyone know if you inherit a model and inherit all the fields with it, can you add more selections to a selection field in the inherited model. For example, if I have a new module that inherits the res.partner table and I want to add more selections to the "type" field, then can I add those new selections in the new module without having to add them to the original module? I know you can create new fields to the inherited model, but I'm not sure you can modify the original fields by giving them more options to choose from like the selection fields. Thank you everyone

Okay so I tested it out to see what it does, and it turns out that it does add the new selections that were added in the inherited module. However, it overwrote the original selections with the new ones. So if you are going to add more selections to choose from in the inherited module, then make sure to also include the original selections, if you don't want to lose them.

on 2/27/14, 2:58 PM

@sudhir: your answer is not what he has asked, you should not have closed his question with wrong answer.

on 3/30/15, 9:09 AM

Hi, in new api the correct way is to use selection_add attribute as in the documentation: class openerp.fields.Selection(selection=None, string=None, **kwargs) Bases: openerp.fields.Field Parameters: selection – specifies the possible values for this field. It is given as either a list of pairs (value, string), or a model method, or a method name. selection_add – provides an extension of the selection in the case of an overridden field. It is a list of pairs (value, string). The attribute selection is mandatory except in the case of related fields or field extensions.

Pouya Maleki
on 9/19/15, 6:31 AM

Sorry for the mess, but the question is closed and i cannot add an answer, in one sentence , just write: state= fields.Selection(selection_add=[('in_progress','In Progress')])

Pouya Maleki
on 9/19/15, 6:34 AM

Sudhir Arya (ERP Harbor Consulting Services)

--Sudhir Arya (ERP Harbor Consulting Services)--
| 6 8 8
Ahmedabad, India
--Sudhir Arya (ERP Harbor Consulting Services)--

• Co-Founder & Co-Owner at ERP Harbor Consulting Services

• ERP Consultant / ERP Customization / TechnoFunctional Expert

• Sound knowledge in Python, Odoo (Open ERP), XML, PostgreSQL

• Domain knowledge of Sale Management, Purchase Management, Warehouse Management, Manufacturing, Multi Company Configuration & Management, HR Management, Medical Management, Construction Management, Education Management, Point of Sale, Third Party Integrations

• Positive attitude and quick Learner

• Good analytical skill, quick bug and issue tracing and find the solution

• Good knowledge and experience in payment gateway integration with Odoo

• Ready to accept new challenges

• Active Memeber On Stackoverflow 




Sudhir Arya
ERP Harbor Consulting Services
Sudhir Arya (ERP Harbor Consulting Services)
On 2/27/14, 6:17 PM

Yes Eric you can do so. But for that you have to include original values with you new values.

Ex: Original value is 'state': fields.selection([('draft', 'New')])

Now I want to add some more values by inherit the object and override the field like this:

'state': fields.selection([('draft', 'New'), ('in_progress', ' In Progress')])

Hope this will help you.

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

0 follower(s)


Asked: 2/27/14, 2:41 PM
Seen: 3138 times
Last updated: 9/19/15, 6:34 AM