Skip to Content
Menu
This question has been flagged
2 Replies
3924 Views

Disclaimer: Total newbie.


I have a two tables, routes (ruta) and drivers (conductor), each route has an assigned driver so in the route model I created a many2one field linking both tables:


conductor_id = fields.Many2one('produccion.conductor', required=True)
conductor_nombre = fields.Char(related='conductor_id.nombre', string="Conductor")


I can succesfully display the drivers name on a list by adding the conductor_nombre field, however, on a form, the dropdown for the driver field displays the driver ID, how do I make it dispaly the driver´s name only?


<field name="conductor_id"/>
Avatar
Discard
Author Best Answer

nevermind, in the conductores model I wasnt defining a 'name' field. 


Avatar
Discard
Best Answer

Hi,

Just to add along with your answer, either you can define a field with the name as name or you can use rec_name to specify which field to show in the drop down.

See: https://www.youtube.com/watch?v=d_cyPsVc7vg


Thanks

Avatar
Discard
Related Posts Replies Views Activity
1
Nov 22
14647
3
Aug 22
10753
2
Aug 22
3045
0
Jul 22
835
2
Oct 21
1435