[FIX] hr_holidays: fix accrual test

The test `test_unused_accrual_postponed` was expecting at least 25
holidays to be accrued, but started failing around mid-December.

closes odoo/odoo#81592

X-original-commit: c2865b7f5b654a61d4b2690133797aa39712b00d
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
This commit is contained in:
Kevin Baptiste
2021-12-17 13:40:06 +00:00
committed by Christophe Monniez
parent 0aa8dbd295
commit b600373abb
@@ -498,28 +498,29 @@ class TestAccrualAllocations(TestHrHolidaysCommon):
def test_unused_accrual_lost(self):
#1 accrual with 2 levels and level transition immediately
accrual_plan = self.env['hr.leave.accrual.plan'].with_context(tracking_disable=True).create({
'name': 'Accrual Plan For Test',
'level_ids': [(0, 0, {
'start_count': 1,
'start_type': 'day',
'added_value': 1,
'added_value_type': 'days',
'frequency': 'daily',
'maximum_leave': 1,
'action_with_unused_accruals': 'lost',
})],
})
allocation = self.env['hr.leave.allocation'].with_user(self.user_hrmanager_id).with_context(tracking_disable=True).create({
'name': 'Accrual allocation for employee',
'accrual_plan_id': accrual_plan.id,
'employee_id': self.employee_emp.id,
'holiday_status_id': self.leave_type.id,
'number_of_days': 10,
'allocation_type': 'accrual',
})
allocation.action_confirm()
allocation.action_validate()
with freeze_time('2021-09-01'):
accrual_plan = self.env['hr.leave.accrual.plan'].with_context(tracking_disable=True).create({
'name': 'Accrual Plan For Test',
'level_ids': [(0, 0, {
'start_count': 1,
'start_type': 'day',
'added_value': 1,
'added_value_type': 'days',
'frequency': 'daily',
'maximum_leave': 1,
'action_with_unused_accruals': 'lost',
})],
})
allocation = self.env['hr.leave.allocation'].with_user(self.user_hrmanager_id).with_context(tracking_disable=True).create({
'name': 'Accrual allocation for employee',
'accrual_plan_id': accrual_plan.id,
'employee_id': self.employee_emp.id,
'holiday_status_id': self.leave_type.id,
'number_of_days': 10,
'allocation_type': 'accrual',
})
allocation.action_confirm()
allocation.action_validate()
with freeze_time('2022-01-01'):
allocation._update_accrual()
@@ -528,28 +529,29 @@ class TestAccrualAllocations(TestHrHolidaysCommon):
def test_unused_accrual_postponed(self):
# 1 accrual with 2 levels and level transition after
# This also tests retroactivity
accrual_plan = self.env['hr.leave.accrual.plan'].with_context(tracking_disable=True).create({
'name': 'Accrual Plan For Test',
'level_ids': [(0, 0, {
'start_count': 1,
'start_type': 'day',
'added_value': 1,
'added_value_type': 'days',
'frequency': 'daily',
'maximum_leave': 25,
'action_with_unused_accruals': 'postponed',
})],
})
allocation = self.env['hr.leave.allocation'].with_user(self.user_hrmanager_id).with_context(tracking_disable=True).create({
'name': 'Accrual allocation for employee',
'accrual_plan_id': accrual_plan.id,
'employee_id': self.employee_emp.id,
'holiday_status_id': self.leave_type.id,
'number_of_days': 10,
'allocation_type': 'accrual',
})
allocation.action_confirm()
allocation.action_validate()
with freeze_time('2021-09-01'):
accrual_plan = self.env['hr.leave.accrual.plan'].with_context(tracking_disable=True).create({
'name': 'Accrual Plan For Test',
'level_ids': [(0, 0, {
'start_count': 1,
'start_type': 'day',
'added_value': 1,
'added_value_type': 'days',
'frequency': 'daily',
'maximum_leave': 25,
'action_with_unused_accruals': 'postponed',
})],
})
allocation = self.env['hr.leave.allocation'].with_user(self.user_hrmanager_id).with_context(tracking_disable=True).create({
'name': 'Accrual allocation for employee',
'accrual_plan_id': accrual_plan.id,
'employee_id': self.employee_emp.id,
'holiday_status_id': self.leave_type.id,
'number_of_days': 10,
'allocation_type': 'accrual',
})
allocation.action_confirm()
allocation.action_validate()
with freeze_time('2022-01-01'):
allocation._update_accrual()