[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#75234 X-original-commit: 3f7f0feb31d80c5cb3364c3a7d530c80b6278b40 Signed-off-by: Anh Thao PHAM <kitan191@users.noreply.github.com> Signed-off-by: Audric Onockx <auon-odoo@users.noreply.github.com>
This commit is contained in:
@@ -183,7 +183,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))
|
||||
|
||||
Reference in New Issue
Block a user