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

hi all,

models: 1) items  2) subcat

event: onchange

I had a model items, contains a Many2one field for category, when user select a value (subcat) i want to get another field value ( parentcat, it is Char type ) from same model - subcat - 

how i can achieve this, please help.

regards


อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hello,

You would want to look at related fields. You would have the field subcat_parentcat on the items model like this:

subcat_parentcat = fields.Char(related="category_id.parentcat")

This would get the parentcat char field of whatever is selected in the Many2one category_id.

I hope this helps,

Thanks, 



อวตาร
ละทิ้ง
ผู้เขียน

thanks for help :)

Related Posts ตอบกลับ มุมมอง กิจกรรม
2
เม.ย. 23
3165
2
ก.พ. 25
41157
2
พ.ย. 22
3164
1
ก.พ. 22
8176
2
ธ.ค. 21
4557