| 1 |
# Part of Odoo. See LICENSE file for full copyright and licensing details. |
| 2 |
|
| 3 |
from odoo.addons.mail.tests.common import mail_new_test_user |
| 4 |
from odoo.tests import common |
| 5 |
|
| 6 |
|
| 7 |
class TestHrHomeworkingCommon(common.TransactionCase): |
| 8 |
|
| 9 |
@classmethod |
| 10 |
def setUpClass(cls): |
| 11 |
super().setUpClass() |
| 12 |
cls.env.user.tz = 'Europe/Brussels' |
| 13 |
|
| 14 |
cls.user_employee = mail_new_test_user(cls.env, login='david', groups='base.group_user') |
| 15 |
|
| 16 |
# Hr Data |
| 17 |
Department = cls.env['hr.department'].with_context(tracking_disable=True) |
| 18 |
WorkLocation = cls.env['hr.work.location'].with_context(tracking_disable=True) |
| 19 |
main_partner_id = cls.env.ref('base.main_partner') |
| 20 |
|
| 21 |
cls.rd_dept = Department.create({ |
| 22 |
'name': 'Research and devlopment', |
| 23 |
}) |
| 24 |
|
| 25 |
cls.work_office_1 = WorkLocation.create({ |
| 26 |
'name': "Bureau 1", |
| 27 |
'location_type': "office", |
| 28 |
'address_id': main_partner_id.id, |
| 29 |
}) |
| 30 |
|
| 31 |
cls.work_office_2 = WorkLocation.create({ |
| 32 |
'name': "Bureau 2", |
| 33 |
'location_type': "office", |
| 34 |
'address_id': main_partner_id.id, |
| 35 |
}) |
| 36 |
|
| 37 |
cls.work_home = WorkLocation.create({ |
| 38 |
'name': "Maison", |
| 39 |
'location_type': "home", |
| 40 |
'address_id': main_partner_id.id, |
| 41 |
}) |
| 42 |
|
| 43 |
cls.employee_emp = cls.env['hr.employee'].create({ |
| 44 |
'name': 'David Employee', |
| 45 |
'user_id': cls.user_employee.id, |
| 46 |
'department_id': cls.rd_dept.id, |
| 47 |
'monday_location_id': cls.work_home.id, |
| 48 |
'tuesday_location_id': cls.work_home.id, |
| 49 |
'wednesday_location_id': cls.work_office_1.id, |
| 50 |
'thursday_location_id': cls.work_office_1.id, |
| 51 |
'friday_location_id': cls.work_office_1.id, |
| 52 |
'saturday_location_id': cls.work_home.id, |
| 53 |
'sunday_location_id': cls.work_home.id, |
| 54 |
}) |