Skip to content
Permalink
Browse files

[FIX] hr: Expose employee timezone on public profile

Purpose
=======

It happens a lot that we access to the employee timezone to compute
presence states, leaves, ...

Instead of sudoing all those accesses, it looks better to expose this
data in the public profile.

closes #35811

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
  • Loading branch information...
tivisse committed Aug 19, 2019
1 parent 1972704 commit be983c7002cce01085f90f44b7fc8b7608bd9f15
Showing with 4 additions and 0 deletions.
  1. +3 −0 addons/hr/models/hr_employee_base.py
  2. +1 −0 addons/hr/models/hr_employee_public.py
@@ -24,3 +24,6 @@ class HrEmployeeBase(models.AbstractModel):
user_id = fields.Many2one('res.users')
resource_id = fields.Many2one('resource.resource')
resource_calendar_id = fields.Many2one('resource.calendar')
tz = fields.Selection(
string='Timezone', related='resource_id.tz', readonly=False,
help="This field is used in order to define in which timezone the resources will work.")
@@ -28,6 +28,7 @@ class HrEmployeePublic(models.Model):
user_id = fields.Many2one(readonly=True)
resource_id = fields.Many2one(readonly=True)
resource_calendar_id = fields.Many2one(readonly=True)
tz = fields.Selection(readonly=True)

# hr.employee.public specific fields
child_ids = fields.One2many('hr.employee.public', 'parent_id', string='Direct subordinates', readonly=True)

0 comments on commit be983c7

Please sign in to comment.
You can’t perform that action at this time.