跳至內容
選單
此問題已被標幟
3543 瀏覽次數

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

相關帖文 回覆 瀏覽次數 活動
3
3月 24
6397
1
5月 22
2559
3
11月 23
16688
3
11月 24
23800
1
4月 23
5639