Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
3 Відповіді
1333 Переглядів

Hi, I created a many2one field in the 'helpdesk.ticket' module called "contact_list" which is related to 'res.partner' and acts very similar to the 'partner_id' field but with edits in the domain, I attach the code of the field creation.


class TestContact(models.Model):
    _inherit = 'helpdesk.ticket'

    contact_list = fields.Many2one('res.partner', string='Customer Contact', domain="['&',('is_company','=',False),('parent_id','=',partner_id)]")

The detail I have is that in the field 'contact_list' it looks like this: "Azure Interior, Brandon Freeman" and I want it to look just "Brandon Freeman". I think the "contact_list" field shows the value of 'display_name' of the contacts that comply with the domain instead of the value of 'name'.


I understand that there is a function called "name_get()" that can help me but I don't know how to use it correctly in this case.


Аватар
Відмінити
Найкраща відповідь

Hi Manuel

You can add the name_get function in res. partner model.

Check this references

Name get Function in odoo

How to Use name_get() function in Odoo 15


Regards


Аватар
Відмінити
Найкраща відповідь

Hey Manuel Chirino,


I hope you are doing well.


I'd like to provide you with a reference screenshots:

I hope this will help you.

Thanks & Regards,
Email: odoo@aktivsoftware.com     

Skype: kalpeshmaheshwari

Аватар
Відмінити
Автор Найкраща відповідь

Thank you very much Bella, I have another question

The "name_get()" function works perfectly but after I select the contact "Brandon Freeman" (for example) and save, it returns to display "Azure Interior, Brandon Freeman" instead of staying the same. Attached are some screenshots to see how to fix this.




Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
name_get Вирішено
2
лип. 24
10065
3
лип. 24
6134
1
груд. 22
3391
0
жовт. 22
2629
1
груд. 21
5338