Skip to content

Commit

Permalink
[FIX] hr_holidays: make test_current_leave_status deterministic
Browse files Browse the repository at this point in the history
The test_current_leave_status checks the correct implementation of different
hr.leave computed fields. To do this, a leave is created, during the test. The
test fails however, when the employee is not supposed to work during the leave
period, which can happen when running the test on certain days. The test is
made deterministic again by adding the number_of_days field to the dict. As
this is a stored field, the created leave entry will be considered valid.

closes odoo#121533

Signed-off-by: Kevin Baptiste <kba@odoo.com>
  • Loading branch information
tdecaluwe committed May 30, 2023
1 parent e8834cb commit a1dffd3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions addons/hr_holidays/tests/test_leave_requests.py
Expand Up @@ -483,8 +483,9 @@ def run_validation_flow(leave_validation_type):
'holiday_type': 'employee',
'employee_id': employee.id,
'holiday_status_id': leave_type.id,
'date_from': datetime.today() - timedelta(days=1),
'date_to': datetime.today() + timedelta(days=1),
'date_from': fields.Date.today(),
'date_to': fields.Date.today() + timedelta(days=2),
'number_of_days': 2,
})

if leave_validation_type in ('manager', 'both'):
Expand Down

0 comments on commit a1dffd3

Please sign in to comment.