diff --git a/exp_timesheet_missing_reminder/tests/test_exp_timesheet_reminder.py b/exp_timesheet_missing_reminder/tests/test_exp_timesheet_reminder.py index 74c6d53..997ffd1 100644 --- a/exp_timesheet_missing_reminder/tests/test_exp_timesheet_reminder.py +++ b/exp_timesheet_missing_reminder/tests/test_exp_timesheet_reminder.py @@ -13,9 +13,21 @@ class TestActionSendLateEmail(TransactionCase): def setUpClass(cls): super().setUpClass() - cls.calendar = cls.env.ref('resource.resource_calendar_standard_12hour', raise_if_not_found=False) - if not cls.calendar: - cls.calendar = cls.env['resource.calendar'].search([], limit=1) + cls.calendar = cls.env['resource.calendar'].create({ + 'name': 'Test Timesheet Calendar', + 'check_timesheet': True, + 'timesheet_day_before': 7, + 'timesheet_hour_before': 12, + + }) + + cls.env['resource.calendar.attendance'].create({ + 'name': 'Test Morning', + 'calendar_id': cls.calendar.id, + 'dayofweek': '0', # Monday + 'hour_from': 8.0, + 'hour_to': 16.0, + }) cls.test_user = cls.env['res.users'].create({ 'name': 'Test Timesheet User', @@ -28,7 +40,8 @@ class TestActionSendLateEmail(TransactionCase): 'user_id': cls.test_user.id, 'work_email': 'test_timesheet@example.com', 'skipp_timesheet_reminder': False, - 'resource_calendar_id': cls.calendar.id if cls.calendar else False, + 'resource_calendar_id': cls.calendar.id, + 'state': 'open', }) cls.project = cls.env['project.project'].create({'name': 'Test Project'})