Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
3347 Lượt xem

Hi, I wanna know if there is any tested and working way to achieve this. I have a selection field which is then converted to radio button in the xml code by adding the "widget='radio' " to the field. Now I wanna get the value of this selection-radio button.

This field is on a different file inside the same model and to access the value I'm doing:

button_id = fields.Many2one('hr_overtime_rule', 'buttons')

then im trying to check the value doing this:

value = button_id
if value == 'per_day':
    do_this()

but I don't know if this is the right way of accessing it. Thanks!
Ảnh đại diện
Huỷ bỏ

Try,
self.button_id.name == 'per_day'

Tác giả

@KiranK, `.name` gave me an error. I removed it and they weren't filtered

Bài viết liên quan Trả lời Lượt xem Hoạt động
3
thg 3 24
6225
1
thg 5 22
2455
3
thg 11 23
16499
3
thg 11 24
23585
1
thg 4 23
5494