コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
2820 ビュー

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 :)

関連投稿 返信 ビュー 活動
2
4月 23
3165
2
2月 25
41157
2
11月 22
3164
1
2月 22
8176
2
12月 21
4557