summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorJérome Maes <jem@openerp.com>2016-06-07 16:04:58 +0200
committerJérome Maes <jem@openerp.com>2016-06-07 16:34:56 +0200
commit0025bc2bb29b9fc17ab1a189fa2bd72226bbbd9a (patch)
treee79fa8fb71335743040571fd5d8fbfd523119832 /addons
parent9b08ef66a6c61bdea9fe25398c192d2dd0bf397f (diff)
[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.
Diffstat (limited to 'addons')
-rw-r--r--addons/hr_holidays/models/hr_holidays.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/addons/hr_holidays/models/hr_holidays.py b/addons/hr_holidays/models/hr_holidays.py
index e0f27ac41e4..0492121f6d2 100644
--- a/addons/hr_holidays/models/hr_holidays.py
+++ b/addons/hr_holidays/models/hr_holidays.py
@@ -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,