Se rendre au contenu
Menu
Cette question a été signalée
1 Répondre
291 Vues

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
Ignorer
Meilleure réponse

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
Ignorer
Auteur

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)

Publications associées Réponses Vues Activité
0
mars 25
1424
0
janv. 25
3508
1
août 23
14872
1
août 23
13522
1
juil. 23
10501