Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
I have a many2one field, it display something like "model.name, 5" where 5 is the ID of my related record.
I just want to display 5 or better, another field of my related record.
Of course i found many topics speaking about this like this one ( https://www.odoo.com/forum/help-1/question/display-recordset-into-record-91284 ) but i don't understand anything :)
I am lost, in the doc and other examples, they speak of compute, name_get, related, etc.
I just want to display another field of my related record, it should be super simple.
Where can I see a very simple example of what to do for Odoo 8.
When any field of type many2one is there inside Odoo. Odoo will take one field from that model for display. That field is by default 'name' taking from the _rec_name attribute of that class because _rec_name = 'name' is default set inside ORM class.
So, if you have not define any field with its name "name" then Odoo will give you the result as you got "Model, Id". To overcome of this you just need to define/set _rec_name inside your class.
For ex. you have one field "xxx" which you want to display on many2one field. then you have to set _rec_name = 'xxx' thats it. Odoo will automatically display value of 'xxx' field when your many2one link is available.
Note : _rec_name = 'name' is default set. So, if you have not define 'name' field in your class/model you have to set _rec_name attribute inside your class.
It will help a lot.
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 10/2/15, 4:44 AM|
|Seen: 849 times|
|Last updated: 10/6/15, 3:16 AM|