Skip to Content
Menú
This question has been flagged
2 Respostes
10080 Vistes

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
Avatar
Descartar

i solved it by adding _rec_name in the model

Best Answer

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

Avatar
Descartar
Related Posts Respostes Vistes Activitat
2
de febr. 25
5899
1
de des. 24
1451
1
de nov. 22
15965
3
d’ag. 22
12993
2
d’ag. 22
4477