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

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


Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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, 



Ảnh đại diện
Huỷ bỏ
Tác giả

thanks for help :)

Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 4 23
3169
2
thg 2 25
41164
2
thg 11 22
3166
1
thg 2 22
8177
2
thg 12 21
4557