hi
i need parent_id of a user from hr.employee to sale.order based on the user_id in hr.employee
so when we create quotation in sale.order parent_id should come as default corresponding to the user from the hr.employee
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
hi
i need parent_id of a user from hr.employee to sale.order based on the user_id in hr.employee
so when we create quotation in sale.order parent_id should come as default corresponding to the user from the hr.employee
Hi Abijith,
employee = self.env['hr.employee'].search([('user_id', '=', self.env.uid)], limit=1)
if employee:
self.manager_id = employee.parent_id.id if employee.parent_id else False
either using a compute function based on above code or using 'related' you can get parent_id based on login user.
employee_id = fields.Many2one('hr.employee', string="Employee",
default=lambda self: self.env.user.employee_id)
manager_id = fields.Many2one('hr.employee', related='employee_id.parent_id')
Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!
Zarejestruj sięPowiązane posty | Odpowiedzi | Widoki | Czynność | |
---|---|---|---|---|
|
1
mar 15
|
4850 | ||
Get current user ID (no username)
Rozwiązane
|
|
8
mar 22
|
40387 | |
|
0
kwi 19
|
3754 | ||
|
3
lis 18
|
3860 | ||
|
3
lis 17
|
15917 |