[FIX] resource: Fix default empty timezone

Since the method `_get_leave_intervals` assumed that field `tz` is always filled in.
There is a case in default function, when `self._context` had key `tz` but its value was `False`,
which may causes null value of field `tz` and lead to mismatch interval between leave and payslip
This commit is contained in:
Duc Dao
2018-02-22 14:09:49 +01:00
committed by RomainLibert
parent 085ff2f9c4
commit ad3cc1b231
2 changed files with 13 additions and 2 deletions
+2 -2
View File
@@ -699,8 +699,8 @@ class ResourceCalendarLeaves(models.Model):
date_from = fields.Datetime('Start Date', required=True)
date_to = fields.Datetime('End Date', required=True)
tz = fields.Selection(
_tz_get, string='Timezone', default=lambda self: self._context.get('tz', self.env.user.tz or 'UTC'),
help="Timezone used when encoding the leave. It is used to correctly"
_tz_get, string='Timezone', default=lambda self: self._context.get('tz') or self.env.user.tz or 'UTC',
help="Timezone used when encoding the leave. It is used to correctly "
"localize leave hours when computing time intervals.")
resource_id = fields.Many2one(
"resource.resource", 'Resource',
+11
View File
@@ -0,0 +1,11 @@
Vietnam, 2018-02-10
I hereby agree to the terms of the Odoo Individual Contributor License
Agreement v1.0.
I declare that I am authorized and able to make this agreement and sign this
declaration.
Signed,
Duc Dao duc.dd@komit-consulting.com https://github.com/novawish