Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
4063 มุมมอง

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!
อวตาร
ละทิ้ง

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

ผู้เขียน

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

Related Posts ตอบกลับ มุมมอง กิจกรรม
Odoo Selection field issue แก้ไขแล้ว
3
มี.ค. 24
6984
Get selected value of selected field? แก้ไขแล้ว
1
พ.ค. 22
2940
How to track One2many field in Odoo12? แก้ไขแล้ว
3
พ.ย. 23
17346
Error: Couldn't load module web แก้ไขแล้ว
3
พ.ย. 24
24987
How I get the current ID of a record ? แก้ไขแล้ว
1
เม.ย. 23
6095