[FIX] hr: avoid duplication of user associated partners
When creating an employee with an associated user, the work email of the employee is copied from the user (or actually the partner associated with the user). However since this [commit], both the mobile_phone and work_email fields on the employee are computed fields based on a linked partner in the work_contact_id field. This partner is created on the fly if it did not previously exist. Both of these behaviors interact in such a way, that the linked partner of the employee is created automatically using the email from the linked partner of the user. This is a bug, since both linked partners of the employee and the user should be the same. The bug is easily resolved by adding the work_contact_id field directly to the values dict for the creation of the employee (instead of the work_email). Reproduction steps: the bug can be easily triggered by repeatedly installing and uninstalling the employees app. An extra partner gets created for each employee in the master or demo data, after each install/uninstall cycle. [commit]: https://github.com/odoo/odoo/commit/3c6060b7bbe9c67aca8073ef43c1e89fb7e820ca opw-3031187 closes odoo/odoo#108045 X-original-commit: 35b7e0e128f1cfd72c11ebb16d68bc48fdcbdb57 Related: odoo/enterprise#35004 Signed-off-by: Kevin Baptiste <kba@odoo.com>
This commit is contained in:
committed by
Kevin Baptiste
parent
aa8de3d4d2
commit
9d9404469c
@@ -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',
|
||||
|
||||
+136
-21
@@ -203,7 +203,7 @@ If you have development competencies, we can propose you specific traineeships</
|
||||
<record id="employee_admin" model="hr.employee">
|
||||
<field name="work_location_id" ref="work_location_1"/>
|
||||
<field name="work_phone">(237)-125-2389</field>
|
||||
<field name="work_email">aiden.hughes71@example.com</field>
|
||||
<field name="work_email">admin@yourcompany.example.com</field>
|
||||
<field name="category_ids" eval="[(6, 0, [ref('employee_category_4'), ref('employee_category_3')])]"/>
|
||||
<field name="job_id" ref="hr.job_ceo"/>
|
||||
<field name="job_title">Chief Executive Officer</field>
|
||||
@@ -211,6 +211,12 @@ If you have development competencies, we can propose you specific traineeships</
|
||||
<field name="create_date">2010-01-01 00:00:00</field>
|
||||
</record>
|
||||
|
||||
<record id="work_contact_al" model="res.partner">
|
||||
<field name="name">Ronnie Hart</field>
|
||||
<field name="email">ronnie.hart87@example.com</field>
|
||||
<field name="image_1920" type="base64" file="hr/static/img/employee_al-image.jpg"/>
|
||||
</record>
|
||||
|
||||
<record id="employee_al" model="hr.employee">
|
||||
<field name="name">Ronnie Hart</field>
|
||||
<field name="department_id" ref="dep_rd"/>
|
||||
@@ -219,14 +225,22 @@ If you have development competencies, we can propose you specific traineeships</
|
||||
<field name="category_ids" eval="[(6, 0, [ref('employee_category_4'), ref('employee_category_3')])]"/>
|
||||
<field name="work_location_id" ref="work_location_1"/>
|
||||
<field name="work_phone">(376)-310-7863</field>
|
||||
<field name="work_email">ronnie.hart87@example.com</field>
|
||||
<field name="work_contact_id" ref="hr.work_contact_al"/>
|
||||
<field name="image_1920" type="base64" file="hr/static/img/employee_al-image.jpg"/>
|
||||
<field name="create_date">2010-01-01 00:00:00</field>
|
||||
</record>
|
||||
|
||||
<record id="work_contact_mit" model="res.partner">
|
||||
<field name="name">Anita Oliver</field>
|
||||
<field name="mobile">(538)-672-3185</field>
|
||||
<field name="email">anita.oliver32@example.com</field>
|
||||
<field name="image_1920" type="base64" file="hr/static/img/employee_mit-image.jpg"/>
|
||||
</record>
|
||||
|
||||
<record id="res_partner_mit_private_address" model="res.partner">
|
||||
<field name="name">Anital Oliver</field>
|
||||
<field name="country_id" ref="base.us"/>
|
||||
<field name="mobile">(538)-672-3185</field>
|
||||
<field name="email">anita.oliver00@example.com</field>
|
||||
<field name="type">private</field>
|
||||
</record>
|
||||
@@ -241,12 +255,17 @@ If you have development competencies, we can propose you specific traineeships</
|
||||
<field name="address_home_id" ref="hr.res_partner_mit_private_address"/>
|
||||
<field name="work_location_id" ref="work_location_1"/>
|
||||
<field name="work_phone">(538)-497-4804</field>
|
||||
<field name="mobile_phone">(538)-672-3185</field>
|
||||
<field name="work_email">anita.oliver32@example.com</field>
|
||||
<field name="work_contact_id" ref="hr.work_contact_mit"/>
|
||||
<field name="image_1920" type="base64" file="hr/static/img/employee_mit-image.jpg"/>
|
||||
<field name="create_date">2010-01-01 00:00:00</field>
|
||||
</record>
|
||||
|
||||
<record id="work_contact_niv" model="res.partner">
|
||||
<field name="name">Sharlene Rhodes</field>
|
||||
<field name="email">sharlene.rhodes49@example.com</field>
|
||||
<field name="image_1920" type="base64" file="hr/static/img/employee_niv-image.jpg"/>
|
||||
</record>
|
||||
|
||||
<record id="employee_niv" model="hr.employee">
|
||||
<field name="name">Sharlene Rhodes</field>
|
||||
<field name="department_id" ref="dep_management"/>
|
||||
@@ -256,11 +275,17 @@ If you have development competencies, we can propose you specific traineeships</
|
||||
<field name="category_ids" eval="[(6, 0, [ref('employee_category_4')])]"/>
|
||||
<field name="work_location_id" ref="work_location_1"/>
|
||||
<field name="work_phone">(450)-719-4182</field>
|
||||
<field name="work_email">sharlene.rhodes49@example.com</field>
|
||||
<field name="work_contact_id" ref="hr.work_contact_niv"/>
|
||||
<field name="image_1920" type="base64" file="hr/static/img/employee_niv-image.jpg"/>
|
||||
<field name="create_date">2010-01-01 00:00:00</field>
|
||||
</record>
|
||||
|
||||
<record id="work_contact_stw" model="res.partner">
|
||||
<field name="name">Randall Lewis</field>
|
||||
<field name="email">randall.lewis74@example.com</field>
|
||||
<field name="image_1920" type="base64" file="hr/static/img/employee_stw-image.jpg"/>
|
||||
</record>
|
||||
|
||||
<record id="employee_stw" model="hr.employee">
|
||||
<field name="name">Randall Lewis</field>
|
||||
<field name="department_id" ref="dep_rd"/>
|
||||
@@ -270,11 +295,17 @@ If you have development competencies, we can propose you specific traineeships</
|
||||
<field name="category_ids" eval="[(6, 0, [ref('employee_category_4')])]"/>
|
||||
<field name="work_location_id" ref="work_location_1"/>
|
||||
<field name="work_phone">(332)-775-6660</field>
|
||||
<field name="work_email">randall.lewis74@example.com</field>
|
||||
<field name="work_contact_id" ref="hr.work_contact_stw"/>
|
||||
<field name="image_1920" type="base64" file="hr/static/img/employee_stw-image.jpg"/>
|
||||
<field name="create_date">2010-01-01 00:00:00</field>
|
||||
</record>
|
||||
|
||||
<record id="work_contact_chs" model="res.partner">
|
||||
<field name="name">Jennie Fletcher</field>
|
||||
<field name="email">jennie.fletcher76@example.com</field>
|
||||
<field name="image_1920" type="base64" file="hr/static/img/employee_chs-image.jpg"/>
|
||||
</record>
|
||||
|
||||
<record id="employee_chs" model="hr.employee">
|
||||
<field name="name">Jennie Fletcher</field>
|
||||
<field name="department_id" ref="dep_rd"/>
|
||||
@@ -284,11 +315,17 @@ If you have development competencies, we can propose you specific traineeships</
|
||||
<field name="category_ids" eval="[(6, 0, [ref('employee_category_4')])]"/>
|
||||
<field name="work_location_id" ref="work_location_1"/>
|
||||
<field name="work_phone">(157)-363-8229</field>
|
||||
<field name="work_email">jennie.fletcher76@example.com</field>
|
||||
<field name="work_contact_id" ref="hr.work_contact_chs"/>
|
||||
<field name="image_1920" type="base64" file="hr/static/img/employee_chs-image.jpg"/>
|
||||
<field name="create_date">2010-01-01 00:00:00</field>
|
||||
</record>
|
||||
|
||||
<record id="work_contact_qdp" model="res.partner">
|
||||
<field name="name">Marc Demo</field>
|
||||
<field name="email">gilles@odoo.com</field>
|
||||
<field name="image_1920" type="base64" file="hr/static/img/employee_qdp-image.png"/>
|
||||
</record>
|
||||
|
||||
<record id="employee_qdp" model="hr.employee">
|
||||
<field name="name">Marc Demo</field>
|
||||
<field name="user_id" ref="base.user_demo"/>
|
||||
@@ -300,11 +337,17 @@ If you have development competencies, we can propose you specific traineeships</
|
||||
<field name="category_ids" eval="[(6, 0, [ref('employee_category_4')])]"/>
|
||||
<field name="work_location_id" ref="work_location_1"/>
|
||||
<field name="work_phone">+3281813700</field>
|
||||
<field name="work_email">gilles@odoo.com</field>
|
||||
<field name="work_contact_id" ref="hr.work_contact_qdp"/>
|
||||
<field name="image_1920" type="base64" file="hr/static/img/employee_qdp-image.png"/>
|
||||
<field name="create_date">2010-01-01 00:00:00</field>
|
||||
</record>
|
||||
|
||||
<record id="work_contact_fme" model="res.partner">
|
||||
<field name="name">Keith Byrd</field>
|
||||
<field name="email">keith.byrd52@example.com</field>
|
||||
<field name="image_1920" type="base64" file="hr/static/img/employee_fme-image.jpg"/>
|
||||
</record>
|
||||
|
||||
<record id="employee_fme" model="hr.employee">
|
||||
<field name="name">Keith Byrd</field>
|
||||
<field name="department_id" ref="dep_rd"/>
|
||||
@@ -314,7 +357,7 @@ If you have development competencies, we can propose you specific traineeships</
|
||||
<field name="category_ids" eval="[(6, 0, [ref('employee_category_4')])]"/>
|
||||
<field name="work_location_id" ref="work_location_1"/>
|
||||
<field name="work_phone">(449)-505-5146</field>
|
||||
<field name="work_email">keith.byrd52@example.com</field>
|
||||
<field name="work_contact_id" ref="hr.work_contact_fme"/>
|
||||
<field name="image_1920" type="base64" file="hr/static/img/employee_fme-image.jpg"/>
|
||||
<field name="create_date">2010-01-01 00:00:00</field>
|
||||
</record>
|
||||
@@ -326,6 +369,12 @@ If you have development competencies, we can propose you specific traineeships</
|
||||
<field name="type">private</field>
|
||||
</record>
|
||||
|
||||
<record id="work_contact_fpi" model="res.partner">
|
||||
<field name="name">Audrey Peterson</field>
|
||||
<field name="email">audrey.peterson25@example.com</field>
|
||||
<field name="image_1920" type="base64" file="hr/static/img/employee_fpi-image.jpg"/>
|
||||
</record>
|
||||
|
||||
<record id="employee_fpi" model="hr.employee">
|
||||
<field name="name">Audrey Peterson</field>
|
||||
<field name="department_id" ref="dep_ps"/>
|
||||
@@ -336,11 +385,17 @@ If you have development competencies, we can propose you specific traineeships</
|
||||
<field name="address_home_id" ref="hr.res_partner_fpi_private_address"/>
|
||||
<field name="work_location_id" ref="work_location_1"/>
|
||||
<field name="work_phone">(203)-276-7903</field>
|
||||
<field name="work_email">audrey.peterson25@example.com</field>
|
||||
<field name="work_contact_id" ref="hr.work_contact_fpi"/>
|
||||
<field name="image_1920" type="base64" file="hr/static/img/employee_fpi-image.jpg"/>
|
||||
<field name="create_date">2010-01-01 00:00:00</field>
|
||||
</record>
|
||||
|
||||
<record id="work_contact_jth" model="res.partner">
|
||||
<field name="name">Toni Jimenez</field>
|
||||
<field name="email">toni.jimenez23@example.com</field>
|
||||
<field name="image_1920" type="base64" file="hr/static/img/employee_jth-image.jpg"/>
|
||||
</record>
|
||||
|
||||
<record id="employee_jth" model="hr.employee">
|
||||
<field name="name">Toni Jimenez</field>
|
||||
<field name="department_id" ref="dep_ps"/>
|
||||
@@ -350,11 +405,17 @@ If you have development competencies, we can propose you specific traineeships</
|
||||
<field name="category_ids" eval="[(6, 0, [ref('employee_category_4'), ref('employee_category_5')])]"/>
|
||||
<field name="work_location_id" ref="work_location_1"/>
|
||||
<field name="work_phone">(663)-707-8451</field>
|
||||
<field name="work_email">toni.jimenez23@example.com</field>
|
||||
<field name="work_contact_id" ref="hr.work_contact_jth"/>
|
||||
<field name="image_1920" type="base64" file="hr/static/img/employee_jth-image.jpg"/>
|
||||
<field name="create_date">2010-01-01 00:00:00</field>
|
||||
</record>
|
||||
|
||||
<record id="work_contact_ngh" model="res.partner">
|
||||
<field name="name">Jeffrey Kelly</field>
|
||||
<field name="email">jeffrey.kelly72@example.com</field>
|
||||
<field name="image_1920" type="base64" file="hr/static/img/employee_ngh-image.jpg"/>
|
||||
</record>
|
||||
|
||||
<record id="employee_ngh" model="hr.employee">
|
||||
<field name="name">Jeffrey Kelly</field>
|
||||
<field name="department_id" ref="dep_sales"/>
|
||||
@@ -364,11 +425,17 @@ If you have development competencies, we can propose you specific traineeships</
|
||||
<field name="category_ids" eval="[(6, 0, [ref('employee_category_4'), ref('employee_category_2')])]"/>
|
||||
<field name="work_location_id" ref="work_location_1"/>
|
||||
<field name="work_phone">(916)-264-7362</field>
|
||||
<field name="work_email">jeffrey.kelly72@example.com</field>
|
||||
<field name="work_contact_id" ref="hr.work_contact_ngh"/>
|
||||
<field name="image_1920" type="base64" file="hr/static/img/employee_ngh-image.jpg"/>
|
||||
<field name="create_date">2010-01-01 00:00:00</field>
|
||||
</record>
|
||||
|
||||
<record id="work_contact_vad" model="res.partner">
|
||||
<field name="name">Tina Williamson</field>
|
||||
<field name="email">tina.williamson98@example.com</field>
|
||||
<field name="image_1920" type="base64" file="hr/static/img/employee_vad-image.jpg"/>
|
||||
</record>
|
||||
|
||||
<record id="employee_vad" model="hr.employee">
|
||||
<field name="name">Tina Williamson</field>
|
||||
<field name="department_id" ref="dep_administration"/>
|
||||
@@ -378,11 +445,17 @@ If you have development competencies, we can propose you specific traineeships</
|
||||
<field name="category_ids" eval="[(6, 0, [ref('employee_category_4')])]"/>
|
||||
<field name="work_location_id" ref="work_location_1"/>
|
||||
<field name="work_phone">(360)-694-7266</field>
|
||||
<field name="work_email">tina.williamson98@example.com</field>
|
||||
<field name="work_contact_id" ref="hr.work_contact_vad"/>
|
||||
<field name="image_1920" type="base64" file="hr/static/img/employee_vad-image.jpg"/>
|
||||
<field name="create_date">2010-01-01 00:00:00</field>
|
||||
</record>
|
||||
|
||||
<record id="work_contact_han" model="res.partner">
|
||||
<field name="name">Walter Horton</field>
|
||||
<field name="email">walter.horton80@example.com</field>
|
||||
<field name="image_1920" type="base64" file="hr/static/img/employee_han-image.jpg"/>
|
||||
</record>
|
||||
|
||||
<record id="employee_han" model="hr.employee">
|
||||
<field name="name">Walter Horton</field>
|
||||
<field name="department_id" ref="dep_rd"/>
|
||||
@@ -390,11 +463,17 @@ If you have development competencies, we can propose you specific traineeships</
|
||||
<field name="job_title">Experienced Developer</field>
|
||||
<field name="work_location_id" ref="work_location_1"/>
|
||||
<field name="work_phone">(350)-912-1201</field>
|
||||
<field name="work_email">walter.horton80@example.com</field>
|
||||
<field name="work_contact_id" ref="hr.work_contact_han"/>
|
||||
<field name="image_1920" type="base64" file="hr/static/img/employee_han-image.jpg"/>
|
||||
<field name="create_date">2010-01-01 00:00:00</field>
|
||||
</record>
|
||||
|
||||
<record id="work_contact_jve" model="res.partner">
|
||||
<field name="name">Paul Williams</field>
|
||||
<field name="email">paul.williams59@example.com</field>
|
||||
<field name="image_1920" type="base64" file="hr/static/img/employee_jve-image.jpg"/>
|
||||
</record>
|
||||
|
||||
<record id="employee_jve" model="hr.employee">
|
||||
<field name="name">Paul Williams</field>
|
||||
<field name="department_id" ref="dep_rd_ltp"/>
|
||||
@@ -402,7 +481,7 @@ If you have development competencies, we can propose you specific traineeships</
|
||||
<field name="job_title">Experienced Developer</field>
|
||||
<field name="work_location_id" ref="work_location_1"/>
|
||||
<field name="work_phone">(114)-262-1607</field>
|
||||
<field name="work_email">paul.williams59@example.com</field>
|
||||
<field name="work_contact_id" ref="hr.work_contact_jve"/>
|
||||
<field name="image_1920" type="base64" file="hr/static/img/employee_jve-image.jpg"/>
|
||||
<field name="create_date">2010-01-01 00:00:00</field>
|
||||
</record>
|
||||
@@ -414,6 +493,12 @@ If you have development competencies, we can propose you specific traineeships</
|
||||
<field name="type">private</field>
|
||||
</record>
|
||||
|
||||
<record id="work_contact_jep" model="res.partner">
|
||||
<field name="name">Doris Cole</field>
|
||||
<field name="email">doris.cole31@example.com</field>
|
||||
<field name="image_1920" type="base64" file="hr/static/img/employee_jep-image.jpg"/>
|
||||
</record>
|
||||
|
||||
<record id="employee_jep" model="hr.employee">
|
||||
<field name="name">Doris Cole</field>
|
||||
<field name="department_id" ref="dep_ps"/>
|
||||
@@ -422,11 +507,17 @@ If you have development competencies, we can propose you specific traineeships</
|
||||
<field name="address_home_id" ref="hr.res_partner_jep_private_address"/>
|
||||
<field name="work_location_id" ref="work_location_1"/>
|
||||
<field name="work_phone">(883)-331-5378</field>
|
||||
<field name="work_email">doris.cole31@example.com</field>
|
||||
<field name="work_contact_id" ref="hr.work_contact_jep"/>
|
||||
<field name="image_1920" type="base64" file="hr/static/img/employee_jep-image.jpg"/>
|
||||
<field name="create_date">2010-01-01 00:00:00</field>
|
||||
</record>
|
||||
|
||||
<record id="work_contact_jod" model="res.partner">
|
||||
<field name="name">Rachel Perry</field>
|
||||
<field name="email">jod@odoo.com</field>
|
||||
<field name="image_1920" type="base64" file="hr/static/img/employee_jod-image.jpg"/>
|
||||
</record>
|
||||
|
||||
<record id="employee_jod" model="hr.employee">
|
||||
<field name="name">Rachel Perry</field>
|
||||
<field name="department_id" ref="dep_sales"/>
|
||||
@@ -434,7 +525,7 @@ If you have development competencies, we can propose you specific traineeships</
|
||||
<field name="job_title">Marketing and Community Manager</field>
|
||||
<field name="work_location_id" ref="work_location_1"/>
|
||||
<field name="work_phone">(206)-267-3735</field>
|
||||
<field name="work_email">jod@odoo.com</field>
|
||||
<field name="work_contact_id" ref="hr.work_contact_jod"/>
|
||||
<field name="image_1920" type="base64" file="hr/static/img/employee_jod-image.jpg"/>
|
||||
<field name="create_date">2010-01-01 00:00:00</field>
|
||||
</record>
|
||||
@@ -446,6 +537,12 @@ If you have development competencies, we can propose you specific traineeships</
|
||||
<field name="type">private</field>
|
||||
</record>
|
||||
|
||||
<record id="work_contact_jog" model="res.partner">
|
||||
<field name="name">Beth Evans</field>
|
||||
<field name="email">beth.evans77@example.com</field>
|
||||
<field name="image_1920" type="base64" file="hr/static/img/employee_jog-image.jpg"/>
|
||||
</record>
|
||||
|
||||
<record id="employee_jog" model="hr.employee">
|
||||
<field name="name">Beth Evans</field>
|
||||
<field name="department_id" ref="dep_rd"/>
|
||||
@@ -454,11 +551,17 @@ If you have development competencies, we can propose you specific traineeships</
|
||||
<field name="address_home_id" ref="hr.res_partner_jog_private_address"/>
|
||||
<field name="work_location_id" ref="work_location_1"/>
|
||||
<field name="work_phone">(754)-532-3841</field>
|
||||
<field name="work_email">beth.evans77@example.com</field>
|
||||
<field name="work_contact_id" ref="hr.work_contact_jog"/>
|
||||
<field name="image_1920" type="base64" file="hr/static/img/employee_jog-image.jpg"/>
|
||||
<field name="create_date">2010-01-01 00:00:00</field>
|
||||
</record>
|
||||
|
||||
<record id="work_contact_jgo" model="res.partner">
|
||||
<field name="name">Ernest Reed</field>
|
||||
<field name="email">ernest.reed47@example.com</field>
|
||||
<field name="image_1920" type="base64" file="hr/static/img/employee_jgo-image.jpg"/>
|
||||
</record>
|
||||
|
||||
<record id="employee_jgo" model="hr.employee">
|
||||
<field name="name">Ernest Reed</field>
|
||||
<field name="department_id" ref="dep_ps"/>
|
||||
@@ -466,11 +569,17 @@ If you have development competencies, we can propose you specific traineeships</
|
||||
<field name="job_title">Consultant</field>
|
||||
<field name="work_location_id" ref="work_location_1"/>
|
||||
<field name="work_phone">(944)-518-8232</field>
|
||||
<field name="work_email">ernest.reed47@example.com</field>
|
||||
<field name="work_contact_id" ref="hr.work_contact_jgo"/>
|
||||
<field name="image_1920" type="base64" file="hr/static/img/employee_jgo-image.jpg"/>
|
||||
<field name="create_date">2010-01-01 00:00:00</field>
|
||||
</record>
|
||||
|
||||
<record id="work_contact_lur" model="res.partner">
|
||||
<field name="name">Eli Lambert</field>
|
||||
<field name="email">eli.lambert22@example.com</field>
|
||||
<field name="image_1920" type="base64" file="hr/static/img/employee_lur-image.jpg"/>
|
||||
</record>
|
||||
|
||||
<record id="employee_lur" model="hr.employee">
|
||||
<field name="name">Eli Lambert</field>
|
||||
<field name="department_id" ref="dep_sales"/>
|
||||
@@ -478,7 +587,7 @@ If you have development competencies, we can propose you specific traineeships</
|
||||
<field name="job_title">Marketing and Community Manager</field>
|
||||
<field name="work_location_id" ref="work_location_1"/>
|
||||
<field name="work_phone">(644)-169-1352</field>
|
||||
<field name="work_email">eli.lambert22@example.com</field>
|
||||
<field name="work_contact_id" ref="hr.work_contact_lur"/>
|
||||
<field name="image_1920" type="base64" file="hr/static/img/employee_lur-image.jpg"/>
|
||||
<field name="create_date">2010-01-01 00:00:00</field>
|
||||
</record>
|
||||
@@ -490,6 +599,12 @@ If you have development competencies, we can propose you specific traineeships</
|
||||
<field name="type">private</field>
|
||||
</record>
|
||||
|
||||
<record id="work_contact_hne" model="res.partner">
|
||||
<field name="name">Abigail Peterson</field>
|
||||
<field name="email">abigail.peterson39@example.com</field>
|
||||
<field name="image_1920" type="base64" file="hr/static/img/employee_hne-image.jpg"/>
|
||||
</record>
|
||||
|
||||
<record id="employee_hne" model="hr.employee">
|
||||
<field name="name">Abigail Peterson</field>
|
||||
<field name="department_id" ref="dep_ps"/>
|
||||
@@ -497,8 +612,8 @@ If you have development competencies, we can propose you specific traineeships</
|
||||
<field name="job_title">Consultant</field>
|
||||
<field name="address_home_id" ref="hr.res_partner_hne_private_address"/>
|
||||
<field name="work_location_id" ref="work_location_1"/>
|
||||
<field name="work_email">abigail.peterson39@example.com</field>
|
||||
<field name="work_phone">(482)-233-3393</field>
|
||||
<field name="work_contact_id" ref="hr.work_contact_hne"/>
|
||||
<field name="image_1920" type="base64" file="hr/static/img/employee_hne-image.jpg"/>
|
||||
<field name="create_date">2010-01-01 00:00:00</field>
|
||||
<field name="marital">married</field>
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user