[FIX] hr_holidays: fix date computation

Since date / datetime refactoring done at 960360afe4 we cannot
encode new leave requests or new allocation requests anymore. This commit
fixes that by correctly setting date / datetime on date / datetime field
and correctly computing one from the other.
This commit is contained in:
Thibault Delavallée
2018-08-07 15:39:36 +02:00
parent 240b338dd9
commit 40922cc027
2 changed files with 5 additions and 5 deletions
+4 -4
View File
@@ -247,8 +247,8 @@ class HolidaysRequest(models.Model):
date_to = date_from + timedelta(hours=self.employee_id.resource_calendar_id.hours_per_day)
self.date_to = date_to
self.request_date_from = date_from
self.request_date_to = date_to
self.request_date_from = date_from.date()
self.request_date_to = date_to.date()
if (date_from and date_to) and (date_from.day < date_to.day):
self.request_unit_all = 'period'
@@ -266,8 +266,8 @@ class HolidaysRequest(models.Model):
date_from = fields.Datetime.from_string(self.date_from)
date_to = fields.Datetime.from_string(self.date_to)
self.request_date_from = date_from
self.request_date_to = date_to
self.request_date_from = date_from.date()
self.request_date_to = date_to.date()
if (date_from and date_to) and (date_from.day < date_to.day):
self.request_unit_all = 'period'
@@ -248,7 +248,7 @@ class HolidaysAllocation(models.Model):
@api.onchange('holiday_status_id')
def _onchange_holiday_status_id(self):
self.date_to = self.holiday_status_id.validity_stop
self.date_to = datetime.combine(self.holiday_status_id.validity_stop, datetime.max.time())
if self.accrual:
self.number_of_days_temp = 0