Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
275 Zobrazení

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
Zrušit
Nejlepší odpověď

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
Zrušit
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)

Related Posts Odpovědi Zobrazení Aktivita
0
bře 25
1420
0
led 25
3502
1
srp 23
14868
1
srp 23
13515
1
čvc 23
10497