Odoo Aide

0
2 Answers
0
Niels Huylebroeck
11/09/2014 06:08

Note with the new api you define a Selection field as follows:

from openerp import api, models, fields

class YourModel(models.Model):

_name = 'your.model'

my_selection_field = fields.Selection([('option1', 'Label 1'), ('option2', 'Label 2')], string='My Selection Field')

Using the new style gives the benefit of being able to extend the selection list by inheriting and redefining as follows:

my_selection_field = fields.Selection(selection_add=[('option3', 'Label 3')])

0
Avatar

Ivan

--Ivan--

3400
| 5 3 7
Jakarta, Indonésie
--Ivan--
Ivan
03/09/2014 03:22

Maybe it is faster if you post your snippet.  In general you need these two part to create a selection field:

_columns = { 'my_selection_field': fields.selection([("code1", "Value 1"), ("code2", "Value 2")), string='My Selection Field')}

and include it in the view.

1 Commentaires
Ivan
03/09/2014 03:25

See this conversation: https://www.odoo.com/forum/help-1/question/odoo7-add-a-field-in-purchase-order-line-but-cant-save-61781

Poser une question
Writer
Étiquettes
Keep Informed
1 Abonné(e)s
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.

Register
Odoo Training Center

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

Test it now