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

i want to get the value 'nom' from model 'wilaya' in my model 'bien' 

in model bien:

wilaya_id=fields.Many2one(comodel_name="immobilier.wilaya")
in model wilaya:
num = fields.Integer()
nom=fields.Char()
bien_ids=fields.One2many(comodel_name="immobilier.bien",inverse_name="wilaya_id")
when i run it gives me the wilaya ID as a selection, how do i get 'nom' instead of ID
アバター
破棄

i solved it by adding _rec_name in the model

最善の回答

Hello,

You can try:

     wilaya_id = fields.Many2one('wilaya_model_here', 'Relation field to model wilaya')
     nom= fields.Char(related=' wilaya_id.nom')

Hope it helps you

Best regards

PM

アバター
破棄
関連投稿 返信 ビュー 活動
2
2月 25
5971
1
12月 24
1494
1
11月 22
16067
3
8月 22
13121
2
8月 22
4567