diff --git a/resource_work_time_from_contracts/tests/test_work_time.py b/resource_work_time_from_contracts/tests/test_work_time.py index 116f505fa..ff78cd8ec 100644 --- a/resource_work_time_from_contracts/tests/test_work_time.py +++ b/resource_work_time_from_contracts/tests/test_work_time.py @@ -3,8 +3,6 @@ from datetime import date, timedelta, timezone -from odoo.addons.test_resource.tests.test_resource import datetime_str - from .test_work_time_base import TestWorkTimeBase diff --git a/resource_work_time_from_contracts/tests/test_work_time_base.py b/resource_work_time_from_contracts/tests/test_work_time_base.py index 4398afed0..acaba1f2c 100644 --- a/resource_work_time_from_contracts/tests/test_work_time_base.py +++ b/resource_work_time_from_contracts/tests/test_work_time_base.py @@ -140,6 +140,13 @@ def to_utc_datetime(self, year, month, day, *args, **kwargs): """ Create a UTC datetime from local time values """ - return self.timezone.localize( - datetime.datetime(year, month, day, *args, **kwargs) - ).astimezone(pytz.utc) + return ( + self.timezone.localize( + datetime.datetime(year, month, day, *args, **kwargs) + ).astimezone(pytz.utc) + # Odoo's ORM refuses to work with datetime objects that have tzinfo + # set. Unset it here instead of doing it manually every time. The + # tzinfo is implicit as a result of this function's name being + # 'to_utc_datetime'. + .replace(tzinfo=None) + )