Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
271 Vistas

Hi guys!!!!

Please who can help me guys please.

I have a many2ne field named "project_id" liked to project_service class. But, it shows me a stucture like this 'project_id': (5, 'project_service,5').

Who can help me why it does display structure like thios. Why dont i get only the id (5)???

Please help

Avatar
Descartar
Mejor respuesta

This field won't show you id on web client but value only, it shows value of rec_name column, best practice is to use 'name'. it is default value of 'rec_name' for a table, if you don't have name column then you must explicitly tell odoo, which field should be used as rec_name.

So in your case table 'project_service' should have a field 'name'. if you don't have 'name' field you must set a column as 'rec_name'.

Avatar
Descartar
Autor

Thanks a lot for the answer. In fact, i have a colum setted rec_name. So the manyone will contain (id, rec_name colum) is it normal??

if you are seeing it at backend it is normal, because m2o is a field referencing value of another table, 'id' is primary key of foreign table, and column name is the name from which value will be taken, If you are seeing this on web client then it is not normal you have some thing wrong, if you want to access id of that value you can do like : object_name.m2o_field.id for value you can do : object_name.m2o_field.column_name(rec_name)

Publicaciones relacionadas Respuestas Vistas Actividad
0
mar 25
1420
0
ene 25
3500
1
ago 23
14867
1
ago 23
13513
1
jul 23
10493