[IMP] hr_holidays: make const with working 8h per day

Having the number 8 in the code makes developers wonder 'why this number ?'. Naming it eases tensions in geek's mind.
This commit is contained in:
Jérome Maes
2016-06-07 16:34:56 +02:00
parent 9b08ef66a6
commit 0025bc2bb2
+5 -2
View File
@@ -15,6 +15,9 @@ from odoo.tools.translate import _
_logger = logging.getLogger(__name__)
HOURS_PER_DAY = 8
class HolidaysType(models.Model):
_name = "hr.holidays.status"
@@ -299,7 +302,7 @@ class Holidays(models.Model):
# No date_to set so far: automatically compute one 8 hours later
if date_from and not date_to:
date_to_with_delta = fields.Datetime.from_string(date_from) + timedelta(hours=8)
date_to_with_delta = fields.Datetime.from_string(date_from) + timedelta(hours=HOURS_PER_DAY)
self.date_to = str(date_to_with_delta)
# Compute and update the number of days
@@ -425,7 +428,7 @@ class Holidays(models.Model):
meeting_values = {
'name': holiday.display_name,
'categ_ids': [(6, 0, [holiday.holiday_status_id.categ_id.id])] if holiday.holiday_status_id.categ_id else [],
'duration': holiday.number_of_days_temp * 8,
'duration': holiday.number_of_days_temp * HOURS_PER_DAY,
'description': holiday.notes,
'user_id': holiday.user_id.id,
'start': holiday.date_from,