[FIX] hr: duplicate employee without keep the same contact

Steps to reproduce:
- create an employee and fill in the email address;
- duplicate this employee;
- change the email address of the new employee.

Issue:
The email address is changed on both employees.

Cause:
When we duplicate an employee, we keep the same contact.
By modifying the email address, we will modify the contact's email address.
Then we "synchronise" all employees with their contact
using the contact information.

Solution:
When an employee is duplicated, a new contact must be created.
Therefore it is necessary to avoid copying the `work_contact_id` field.

opw-3144129

closes odoo/odoo#111201

X-original-commit: 1582f6834bee2123f8703b2ae52996b0978e2311
Signed-off-by: Kevin Baptiste <kba@odoo.com>
Signed-off-by: Lefebvre Thomas (thle) <thle@odoo.com>
This commit is contained in:
Thomas Lefebvre (thle)
2023-01-27 12:58:46 +01:00
parent 865bd89eba
commit ea96e51e9e
+1 -1
View File
@@ -30,7 +30,7 @@ class HrEmployeeBase(models.AbstractModel):
work_phone = fields.Char('Work Phone', compute="_compute_phones", store=True, readonly=False)
mobile_phone = fields.Char('Work Mobile', compute="_compute_work_contact_details", store=True, inverse='_inverse_work_contact_details')
work_email = fields.Char('Work Email', compute="_compute_work_contact_details", store=True, inverse='_inverse_work_contact_details')
work_contact_id = fields.Many2one('res.partner', 'Work Contact')
work_contact_id = fields.Many2one('res.partner', 'Work Contact', copy=False)
related_contact_ids = fields.Many2many('res.partner', 'Related Contacts', compute='_compute_related_contacts')
related_contacts_count = fields.Integer('Number of related contacts', compute='_compute_related_contacts_count')
work_location_id = fields.Many2one('hr.work.location', 'Work Location', compute="_compute_work_location_id", store=True, readonly=False,