diff options
| author | Nisha patel <nit@odoo.com> | 2020-03-03 12:59:18 +0000 |
|---|---|---|
| committer | Barad Mahendra <mba@openerp.com> | 2020-03-04 09:02:53 +0000 |
| commit | 3c1b50c510067551aa5d2fdc0362daae62e18bab (patch) | |
| tree | 6cfb2f110d11aa98a7eb988d864c636a597eb022 /addons/hr_holidays/models | |
| parent | 74f7660ccbc3a2463ffda1f53e5c81bd70590b7f (diff) | |
[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>
Diffstat (limited to 'addons/hr_holidays/models')
| -rw-r--r-- | addons/hr_holidays/models/hr_leave_allocation.py | 3 |
1 files changed, 3 insertions, 0 deletions
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': |
