From 3c1b50c510067551aa5d2fdc0362daae62e18bab Mon Sep 17 00:00:00 2001 From: Nisha patel Date: Tue, 3 Mar 2020 12:59:18 +0000 Subject: [PATCH] [IMP] hr_holidays: Allow to add accrual per days on leave allocation Purpose of this task is some people would like to make accrual in days but currently accruals work on different periods(week,month,year). So in this commit, we added "days" as "interval unit" for leave allocation with type accrual. closes odoo/odoo#46751 Taskid: 2168023 Closes: #46751 Signed-off-by: Yannick Tivisse (yti) --- addons/hr_holidays/models/hr_leave_allocation.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/hr_holidays/models/hr_leave_allocation.py b/addons/hr_holidays/models/hr_leave_allocation.py index a6ef894f174..f4143fec516 100644 --- a/addons/hr_holidays/models/hr_leave_allocation.py +++ b/addons/hr_holidays/models/hr_leave_allocation.py @@ -132,6 +132,7 @@ class HolidaysAllocation(models.Model): ('days', 'Days') ], string="Unit of time added at each interval", default='hours', readonly=True, states={'draft': [('readonly', False)], 'confirm': [('readonly', False)]}) interval_unit = fields.Selection([ + ('days', 'Days'), ('weeks', 'Weeks'), ('months', 'Months'), ('years', 'Years') @@ -169,6 +170,8 @@ class HolidaysAllocation(models.Model): delta = relativedelta(days=0) + if holiday.interval_unit == 'days': + delta = relativedelta(days=holiday.interval_number) if holiday.interval_unit == 'weeks': delta = relativedelta(weeks=holiday.interval_number) if holiday.interval_unit == 'months':