[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) <yti@odoo.com>
This commit is contained in:
Nisha patel
2020-03-04 09:02:53 +00:00
committed by Barad Mahendra
parent 74f7660ccb
commit 3c1b50c510
@@ -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':