I have been battling about with some selection fields and can't get them to work. Whenever I add them to my views it gives me XML erorr. So something must be wrong.
Does anybody has a guide for this?
Thank you
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
I have been battling about with some selection fields and can't get them to work. Whenever I add them to my views it gives me XML erorr. So something must be wrong.
Does anybody has a guide for this?
Thank you
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')])
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.
See this conversation: https://www.odoo.com/forum/help-1/question/odoo7-add-a-field-in-purchase-order-line-but-cant-save-61781
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
1
thg 3 15
|
3470 | ||
|
1
thg 4 25
|
192 | ||
Odoo 10 selection field
Đã xử lý
|
|
2
thg 9 17
|
11953 | |
|
1
thg 5 23
|
2312 | ||
|
2
thg 3 18
|
4504 |