[FIX] hr_employee: ensure desynchronization with user
Steps to reproduce: ------------------- - create a new employee; - link it to an existing user; - save (trigger a validation error); - remove the related user; - save; - change the email address of this new employee; Issue: ------ The email address of the employee linked to the user that we tried to link is updated. Cause: ------ We don't sync the employee with the user if the user is `False`, i.e. we don't update the employee's `work_contact_id` if the `user_id` is `False`. Solution: --------- Update the `work_contact_id` in any case. opw-3475002 closes odoo/odoo#133191 X-original-commit: c2f2dc3e49ee7cd96d4da05f2236441e65090753 Signed-off-by: Sofie Gvaladze (sgv) <sgv@odoo.com> Signed-off-by: Thomas Lefebvre (thle) <thle@odoo.com>
This commit is contained in:
@@ -332,10 +332,9 @@ class HrEmployeePrivate(models.Model):
|
||||
|
||||
@api.onchange('user_id')
|
||||
def _onchange_user(self):
|
||||
if self.user_id:
|
||||
self.update(self._sync_user(self.user_id, (bool(self.image_1920))))
|
||||
if not self.name:
|
||||
self.name = self.user_id.name
|
||||
self.update(self._sync_user(self.user_id, (bool(self.image_1920))))
|
||||
if not self.name:
|
||||
self.name = self.user_id.name
|
||||
|
||||
@api.onchange('resource_calendar_id')
|
||||
def _onchange_timezone(self):
|
||||
|
||||
Reference in New Issue
Block a user