Hi.
In a relation field many2one created by studio (Many is a new model, One is Employee); by default, the popup window shows the Employee name, I need display the Identification Number.
How can I change that behavior?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hi.
In a relation field many2one created by studio (Many is a new model, One is Employee); by default, the popup window shows the Employee name, I need display the Identification Number.
How can I change that behavior?
Hello Juan Botero Tech,
- To change the display name for the many2one field’s drop-down, either you can manage to do it using function ‘name_get’ or using _rec_name.
- You can serve this purpose just by using _rec_name.
- Or if you want to add more modifications to the display name then call the name_get function.
- Just in case if you want to display the identification number on the tree view that is visible from the search more option in the many2one field, then you can just make the field visible on the tree view of the hr employee.
Please find code in comment.
I hope this information is helpful to you.
Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari
Please find the below example:
class HrEmployee(models.Model):
_inherit = "hr.employee"
_rec_name = "identification_id"
def name_get(self):
result = []
for rec in self:
result.append((rec.id, '%s' % (rec.identification_id)))
return result
Thank you Jainesh, The thing is that I choose the relation field (Many2One) with Odoo Studio, then the widget shows the name by default, to see the Identification number, the user needs to Click to 'Search more' Link.
I think that is imperative to create the new module by code.
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
3
Feb 25
|
35330 | ||
|
2
Jun 23
|
2795 | ||
|
0
Aug 22
|
2170 | ||
|
2
Aug 15
|
4879 | ||
|
2
Mar 15
|
4211 |