Skip to content
Snippets Groups Projects
Commit 3f7f0feb authored by Audric Onockx (auon)'s avatar Audric Onockx (auon)
Browse files

[FIX] hr_holidays: Fix accrual dates based on creation date


Steps:
1. Create new time off allocation
2. Set type to accrual and set start date other than present day
3. Set the accrual to add every month
4. Validate and run the scheduled action for Accrual Time Off
5. Check the field 'nextcall' with Studio or editing form view
Result:
Nextcall date is set to 1 month after the date of creation of allocation record instead of start date.

Solution:
Nextcall is now based on start date.

opw-2558480

closes odoo/odoo#75177

Signed-off-by: default avatarAnh Thao PHAM <kitan191@users.noreply.github.com>
parent dc195e7b
No related branches found
No related tags found
No related merge requests found
......@@ -180,7 +180,12 @@ class HolidaysAllocation(models.Model):
if holiday.interval_unit == 'years':
delta = relativedelta(years=holiday.interval_number)
values['nextcall'] = (holiday.nextcall if holiday.nextcall else today) + delta
if holiday.nextcall:
values['nextcall'] = holiday.nextcall + delta
else:
values['nextcall'] = holiday.date_from
while values['nextcall'] <= datetime.combine(today, time(0, 0, 0)):
values['nextcall'] += delta
period_start = datetime.combine(today, time(0, 0, 0)) - delta
period_end = datetime.combine(today, time(0, 0, 0))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment