Odoo Help


How to change string value for a selection field?

on 1/13/15, 10:00 PM 2,457 views

For example I have a selection field like this :

'state': fields.selection([('start','Start'),('break','Break'),('finish','Finish')], 'State', readonly=True),

In the other condition I want to change 'Start' to be 'In Progress'.

How can I do it?


Dhinesh - Technical Consultant, Sodexis Inc

--Dhinesh - Technical Consultant, Sodexis Inc--
| 5 4 9
Pondicherry, India
--Dhinesh - Technical Consultant, Sodexis Inc--

Passionate coder in Python/OpenERP. Knows Django/Flask MVC frameworks. Did code in Java, PHP.

Contact me at: dvdhinesh.mail@gmail.com

Dhinesh - Technical Consultant, Sodexis Inc
On 1/13/15, 10:22 PM

Go through this link:


If your selection field is static list of tuples defined in field, then there is no way to do. If it is a method or global variable you can change it.

Using Global Variable:

GLOBAL_VALUE = [('1', 'Excellent'), ('2', 'Very Good')]

'your_field': fields.selection(GLOBAL_VALUE, 'Field Name')

Using Method:

    def _your_method(self, cr, uid, context=None):
        return [('1', 'Excellent'),('2', 'Very Good')]

'your_field': fields.selection(_your_method, string='Field Name')

Return the values based on your need.

How to do it in method or global?

on 1/13/15, 10:43 PM

I have updated my answer.

Dhinesh - Technical Consultant, Sodexis Inc
on 1/14/15, 12:17 AM

Ok, thanks you Mr. Dhinesh

on 1/14/15, 3:07 AM
Tanveer Singh
On 1/14/15, 12:08 AM

Dhinesh has pointed you to the correct link.

Below I am giving an extract of the exact portion from the page in response to your query of how to do it in a method.

  1. Specifying using a method: 'field_1': fields.selection(_method_name, 'Field Label').  Where _method_name is defined beforehand:

def _method_name(self, cr, uid, context=None):

    return [('value1', 'String 1'), ('value2', 'String 2')]

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: 1/13/15, 10:00 PM
Seen: 2457 times
Last updated: 6/7/17, 2:40 AM