Help

0

How to display a specific column in many2one field dropdown?

Avatar
Daniele Morelli

Hi, I am using odoo11.

I have two models. The first model inherits from res.partner and has a custom field "code". The other model is a new one built from scratch (let's call it model_X), and has a many2one field referring to res.partner.

By default, in my form view for model_X, the dropdown related to the many2one field displays the description of the partner. I would like the "code" field to be displayed instead.

Is that possible? Thank you as always.

Daniele

1 Commento
Avatar
Abbandona
Avatar
Niyas Raphy
-

See this, using name_get function: https://www.youtube.com/watch?v=-1r3WSwtqxQ

2 Risposte
1
Avatar
subbarao
Best Answer

use the name_get() method to display code

3 Commenti
Avatar
Abbandona
Avatar
Daniele Morelli
-

Thanks for the answer, this actually works, but then every occurrence of res.partner's name is going to change everywhere. Is there a way to obtain the same result only in that specific dropdown many2one field? Thanks

Avatar
Daniele Morelli
-

Well i guess that the following thread offers a possible solution to what i was looking for... i link it here for reference: https://www.odoo.com/forum/help-1/question/using-name-get-how-to-shows-two-different-display-values-2589

0
Avatar
Ưng Tú
Best Answer

But i want other column show only in search drop down. When i use name_get, and i save record, field many2one will show all field that i defined in name_get function. 

Avatar
Abbandona