Skip to Content
Menu
Dette spørgsmål er blevet anmeldt
1 Svar
277 Visninger

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
Kassér
Bedste svar

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
Kassér
Forfatter

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)

Related Posts Besvarelser Visninger Aktivitet
0
mar. 25
1420
0
jan. 25
3502
1
aug. 23
14868
1
aug. 23
13515
1
jul. 23
10497