[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 odoo/odoo#35811

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
This commit is contained in:
Yannick Tivisse
2019-08-19 12:05:19 +00:00
parent 19727047ce
commit be983c7002
2 changed files with 4 additions and 0 deletions
+3
View File
@@ -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.")
+1
View File
@@ -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)