diff --git a/addons/hr_holidays/models/hr_leave_allocation.py b/addons/hr_holidays/models/hr_leave_allocation.py index 20c44ae7a9e..4f568334646 100644 --- a/addons/hr_holidays/models/hr_leave_allocation.py +++ b/addons/hr_holidays/models/hr_leave_allocation.py @@ -411,6 +411,9 @@ class HolidaysAllocation(models.Model): continue allocation.lastcall = max(allocation.lastcall, first_level_start_date) allocation.nextcall = first_level._get_next_date(allocation.lastcall) + if len(level_ids) > 1: + second_level_start_date = allocation.date_from + get_timedelta(level_ids[1].start_count, level_ids[1].start_type) + allocation.nextcall = min(second_level_start_date - relativedelta(days=1), allocation.nextcall) allocation._message_log(body=first_allocation) days_added_per_level = defaultdict(lambda: 0) while allocation.nextcall <= today: