This commit is contained in:
esam 2025-12-21 08:26:46 -05:00
parent 178be1d641
commit 5ec9eb2ecc
1 changed files with 17 additions and 4 deletions

View File

@ -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'})