From 86a99af1f685208e97b89ac24461f33107980a52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=20De=20Caluw=C3=A9?= <tdc@odoo.com> Date: Tue, 16 May 2023 12:31:08 +0000 Subject: [PATCH] [FIX] hr_holidays: make test_current_leave_status deterministic 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/odoo#122826 X-original-commit: a1dffd3f44e81289cbd67174bb094326a5df505d Signed-off-by: Kevin Baptiste <kba@odoo.com> --- addons/hr_holidays/tests/test_leave_requests.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/hr_holidays/tests/test_leave_requests.py b/addons/hr_holidays/tests/test_leave_requests.py index 7b3b024e6075..746f6e245c1f 100644 --- a/addons/hr_holidays/tests/test_leave_requests.py +++ b/addons/hr_holidays/tests/test_leave_requests.py @@ -913,8 +913,9 @@ class TestLeaveRequests(TestHrHolidaysCommon): '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'): -- GitLab