From 7d94171f522b403ade2bd8ad9625f76c166cb2f3 Mon Sep 17 00:00:00 2001 From: Philippe Wauthy Date: Mon, 3 Jan 2022 09:32:25 +0000 Subject: [PATCH] [FIX] hr_holidays: fix test_leave_whole_company_07 test test_leave_whole_company_07 test was failing due ot the hr_leave_date_check2 constraint. This constraint check that date_from <= date_to for a leave. date_from and date_to were not assigned any value before and had a default value of fields.Datetime.now. Depending on which date_from or date_to is created first, a few second difference can exist and this violates the hr_leave_date_check2 constraint task-2726143 closes odoo/odoo#82177 X-original-commit: 77a5dfd120277fbba3cf368e6ae47f06635c3237 Signed-off-by: Kevin Baptiste --- addons/hr_holidays/tests/test_company_leave.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/hr_holidays/tests/test_company_leave.py b/addons/hr_holidays/tests/test_company_leave.py index 6543ef13c620d..2166568ab3342 100644 --- a/addons/hr_holidays/tests/test_company_leave.py +++ b/addons/hr_holidays/tests/test_company_leave.py @@ -297,7 +297,9 @@ def test_leave_whole_company_07(self): 'employee_id': employee.id, 'holiday_status_id': self.paid_time_off.id, 'request_date_from': date(2020, 3, 29), + 'date_from': datetime(2020, 3, 29, 7, 0, 0), 'request_date_to': date(2020, 4, 1), + 'date_to': datetime(2020, 4, 1, 19, 0, 0), 'number_of_days': 3, } for employee in employees[0:15]]) leaves._compute_date_from_to()