Skip to Content
Menu
This question has been flagged
2 Replies
2419 Views

Hello,

I need to get the department and manager of the employee directly after selecting an employee's name

Thank you in advance for any help

Avatar
Discard
Best Answer

Hi  jenan soliman,

You can use 'related' to achieve this.

employee_id = fields.Many2one('hr.employee', string='Employee',required=True)
department = fields.Many2one('hr.department', string='Department', related='employee_id.department_id')
parent_id = fields.Many2one('hr.employee', string='Manager', related='employee_id.parent_id')


Hope it helps,
Kiran K


Avatar
Discard
Best Answer

Using Related you can achieve this

department = fields.Many2one('hr.department', string='Department', related='employee_id.department_id')

Avatar
Discard
Related Posts Replies Views Activity
3
Oct 23
5977
1
Sep 23
1968
1
May 23
1004
2
Apr 23
1377
1
Mar 23
996