diff --git a/addons/google_calendar/tests/test_sync_google2odoo.py b/addons/google_calendar/tests/test_sync_google2odoo.py index 5743bd5f627..2f8171198e2 100644 --- a/addons/google_calendar/tests/test_sync_google2odoo.py +++ b/addons/google_calendar/tests/test_sync_google2odoo.py @@ -15,6 +15,11 @@ class TestSyncGoogle2Odoo(TestSyncGoogle): def setUp(self): super().setUp() + self.public_partner = self.env['res.partner'].create({ + 'name': 'Public Contact', + 'email': 'public_email@example.com', + 'type': 'contact', + }) self.private_partner = self.env['res.partner'].create({ 'name': 'Private Contact', 'email': 'private_email@example.com', @@ -41,7 +46,7 @@ class TestSyncGoogle2Odoo(TestSyncGoogle): 'visibility': 'public', 'attendees': [{ 'displayName': 'Mitchell Admin', - 'email': 'admin@yourcompany.example.com', + 'email': self.public_partner.email, 'responseStatus': 'needsAction' },], 'reminders': {'useDefault': True}, @@ -62,9 +67,9 @@ class TestSyncGoogle2Odoo(TestSyncGoogle): self.assertEqual(html2plaintext(event.description), values.get('description')) self.assertEqual(event.start, datetime(2020, 1, 13, 15, 55)) self.assertEqual(event.stop, datetime(2020, 1, 13, 18, 55)) - admin_attendee = event.attendee_ids.filtered(lambda e: e.email == 'admin@yourcompany.example.com') - self.assertEqual('admin@yourcompany.example.com', admin_attendee.email) - self.assertEqual('Mitchell Admin', admin_attendee.partner_id.name) + admin_attendee = event.attendee_ids.filtered(lambda e: e.email == self.public_partner.email) + self.assertEqual(self.public_partner.email, admin_attendee.email) + self.assertEqual(self.public_partner.name, admin_attendee.partner_id.name) self.assertEqual(event.partner_ids, event.attendee_ids.partner_id) self.assertEqual('needsAction', admin_attendee.state) self.assertGoogleAPINotCalled() @@ -749,7 +754,7 @@ class TestSyncGoogle2Odoo(TestSyncGoogle): 'visibility': 'public', 'attendees': [{ 'displayName': 'Mitchell Admin', - 'email': 'admin@yourcompany.example.com', + 'email': self.public_partner.email, 'responseStatus': 'needsAction' }, ], 'reminders': {'useDefault': True}, @@ -799,7 +804,7 @@ class TestSyncGoogle2Odoo(TestSyncGoogle): 'visibility': 'public', 'attendees': [{ 'displayName': 'Mitchell Admin', - 'email': 'admin@yourcompany.example.com', + 'email': self.public_partner.email, 'responseStatus': 'needsAction' }, ], 'reminders': {'overrides': [{"method": "email", "minutes": 10}], 'useDefault': False}, @@ -828,7 +833,7 @@ class TestSyncGoogle2Odoo(TestSyncGoogle): 'visibility': 'public', 'attendees': [{ 'displayName': 'Mitchell Admin', - 'email': 'admin@yourcompany.example.com', + 'email': self.public_partner.email, 'responseStatus': 'needsAction' }, ], 'reminders': {'overrides': [{"method": "email", "minutes": 10}], 'useDefault': False}, @@ -1094,7 +1099,7 @@ class TestSyncGoogle2Odoo(TestSyncGoogle): 'visibility': 'public', 'attendees': [{ 'displayName': 'Mitchell Admin', - 'email': 'admin@yourcompany.example.com', + 'email': self.public_partner.email, 'responseStatus': 'needsAction' },], 'reminders': {'useDefault': True}, @@ -1134,7 +1139,7 @@ class TestSyncGoogle2Odoo(TestSyncGoogle): 'visibility': 'public', 'attendees': [{ 'displayName': 'Mitchell Admin', - 'email': 'admin@yourcompany.example.com', + 'email': self.public_partner.email, 'responseStatus': 'needsAction' },], 'reminders': {'useDefault': True}, @@ -1164,7 +1169,7 @@ class TestSyncGoogle2Odoo(TestSyncGoogle): 'visibility': 'public', 'attendees': [{ 'displayName': 'Mitchell Admin', - 'email': 'admin@yourcompany.example.com', + 'email': self.public_partner.email, 'responseStatus': 'needsAction' }, { 'displayName': 'Attendee', diff --git a/addons/hr/data/hr_demo.xml b/addons/hr/data/hr_demo.xml index 7f99d3df2c7..5721cb6f592 100644 --- a/addons/hr/data/hr_demo.xml +++ b/addons/hr/data/hr_demo.xml @@ -203,7 +203,7 @@ If you have development competencies, we can propose you specific traineeships (237)-125-2389 - aiden.hughes71@example.com + admin@yourcompany.example.com Chief Executive Officer @@ -211,6 +211,12 @@ If you have development competencies, we can propose you specific traineeships2010-01-01 00:00:00 + + Ronnie Hart + ronnie.hart87@example.com + + + Ronnie Hart @@ -219,14 +225,22 @@ If you have development competencies, we can propose you specific traineeships (376)-310-7863 - ronnie.hart87@example.com + 2010-01-01 00:00:00 + + Anita Oliver + (538)-672-3185 + anita.oliver32@example.com + + + Anital Oliver + (538)-672-3185 anita.oliver00@example.com private @@ -241,12 +255,17 @@ If you have development competencies, we can propose you specific traineeships (538)-497-4804 - (538)-672-3185 - anita.oliver32@example.com + 2010-01-01 00:00:00 + + Sharlene Rhodes + sharlene.rhodes49@example.com + + + Sharlene Rhodes @@ -256,11 +275,17 @@ If you have development competencies, we can propose you specific traineeships (450)-719-4182 - sharlene.rhodes49@example.com + 2010-01-01 00:00:00 + + Randall Lewis + randall.lewis74@example.com + + + Randall Lewis @@ -270,11 +295,17 @@ If you have development competencies, we can propose you specific traineeships (332)-775-6660 - randall.lewis74@example.com + 2010-01-01 00:00:00 + + Jennie Fletcher + jennie.fletcher76@example.com + + + Jennie Fletcher @@ -284,11 +315,17 @@ If you have development competencies, we can propose you specific traineeships (157)-363-8229 - jennie.fletcher76@example.com + 2010-01-01 00:00:00 + + Marc Demo + gilles@odoo.com + + + Marc Demo @@ -300,11 +337,17 @@ If you have development competencies, we can propose you specific traineeships +3281813700 - gilles@odoo.com + 2010-01-01 00:00:00 + + Keith Byrd + keith.byrd52@example.com + + + Keith Byrd @@ -314,7 +357,7 @@ If you have development competencies, we can propose you specific traineeships (449)-505-5146 - keith.byrd52@example.com + 2010-01-01 00:00:00 @@ -326,6 +369,12 @@ If you have development competencies, we can propose you specific traineeshipsprivate + + Audrey Peterson + audrey.peterson25@example.com + + + Audrey Peterson @@ -336,11 +385,17 @@ If you have development competencies, we can propose you specific traineeships (203)-276-7903 - audrey.peterson25@example.com + 2010-01-01 00:00:00 + + Toni Jimenez + toni.jimenez23@example.com + + + Toni Jimenez @@ -350,11 +405,17 @@ If you have development competencies, we can propose you specific traineeships (663)-707-8451 - toni.jimenez23@example.com + 2010-01-01 00:00:00 + + Jeffrey Kelly + jeffrey.kelly72@example.com + + + Jeffrey Kelly @@ -364,11 +425,17 @@ If you have development competencies, we can propose you specific traineeships (916)-264-7362 - jeffrey.kelly72@example.com + 2010-01-01 00:00:00 + + Tina Williamson + tina.williamson98@example.com + + + Tina Williamson @@ -378,11 +445,17 @@ If you have development competencies, we can propose you specific traineeships (360)-694-7266 - tina.williamson98@example.com + 2010-01-01 00:00:00 + + Walter Horton + walter.horton80@example.com + + + Walter Horton @@ -390,11 +463,17 @@ If you have development competencies, we can propose you specific traineeshipsExperienced Developer (350)-912-1201 - walter.horton80@example.com + 2010-01-01 00:00:00 + + Paul Williams + paul.williams59@example.com + + + Paul Williams @@ -402,7 +481,7 @@ If you have development competencies, we can propose you specific traineeshipsExperienced Developer (114)-262-1607 - paul.williams59@example.com + 2010-01-01 00:00:00 @@ -414,6 +493,12 @@ If you have development competencies, we can propose you specific traineeshipsprivate + + Doris Cole + doris.cole31@example.com + + + Doris Cole @@ -422,11 +507,17 @@ If you have development competencies, we can propose you specific traineeships (883)-331-5378 - doris.cole31@example.com + 2010-01-01 00:00:00 + + Rachel Perry + jod@odoo.com + + + Rachel Perry @@ -434,7 +525,7 @@ If you have development competencies, we can propose you specific traineeshipsMarketing and Community Manager (206)-267-3735 - jod@odoo.com + 2010-01-01 00:00:00 @@ -446,6 +537,12 @@ If you have development competencies, we can propose you specific traineeshipsprivate + + Beth Evans + beth.evans77@example.com + + + Beth Evans @@ -454,11 +551,17 @@ If you have development competencies, we can propose you specific traineeships (754)-532-3841 - beth.evans77@example.com + 2010-01-01 00:00:00 + + Ernest Reed + ernest.reed47@example.com + + + Ernest Reed @@ -466,11 +569,17 @@ If you have development competencies, we can propose you specific traineeshipsConsultant (944)-518-8232 - ernest.reed47@example.com + 2010-01-01 00:00:00 + + Eli Lambert + eli.lambert22@example.com + + + Eli Lambert @@ -478,7 +587,7 @@ If you have development competencies, we can propose you specific traineeshipsMarketing and Community Manager (644)-169-1352 - eli.lambert22@example.com + 2010-01-01 00:00:00 @@ -490,6 +599,12 @@ If you have development competencies, we can propose you specific traineeshipsprivate + + Abigail Peterson + abigail.peterson39@example.com + + + Abigail Peterson @@ -497,8 +612,8 @@ If you have development competencies, we can propose you specific traineeshipsConsultant - abigail.peterson39@example.com (482)-233-3393 + 2010-01-01 00:00:00 married diff --git a/addons/hr/models/hr_employee.py b/addons/hr/models/hr_employee.py index 310248674f8..e45caaa4d6c 100644 --- a/addons/hr/models/hr_employee.py +++ b/addons/hr/models/hr_employee.py @@ -299,7 +299,7 @@ class HrEmployeePrivate(models.Model): def _sync_user(self, user, employee_has_image=False): vals = dict( - work_email=user.email, + work_contact_id=user.partner_id.id, user_id=user.id, ) if not employee_has_image: diff --git a/addons/hr/tests/test_hr_employee.py b/addons/hr/tests/test_hr_employee.py index 003d0090c7d..087e3e407c6 100644 --- a/addons/hr/tests/test_hr_employee.py +++ b/addons/hr/tests/test_hr_employee.py @@ -21,6 +21,11 @@ class TestHrEmployee(TestHrCommon): 'image_1920': False }) + def test_employee_linked_partner(self): + user_partner = self.user_without_image.partner_id + work_contact = self.employee_without_image.work_contact_id + self.assertEqual(user_partner, work_contact) + def test_employee_resource(self): _tz = 'Pacific/Apia' self.res_users_hr_officer.company_id.resource_calendar_id.tz = _tz