[FIX] hr: use correct name when creating employee from user wizard

When creating a user and employee from the wizard, the employee was
taking the default name from the context instead of the one chosen
in the wizard.

closes odoo/odoo#88368

Taskid: 2819821
Signed-off-by: Kevin Baptiste <kba@odoo.com>
This commit is contained in:
Kevin Baptiste
2022-04-11 10:01:47 +02:00
parent bb37bd915e
commit 9b53cbe575
+2 -1
View File
@@ -3,6 +3,7 @@
from odoo import api, models, fields, _, SUPERUSER_ID
from odoo.exceptions import AccessError
from odoo.tools.misc import clean_context
HR_READABLE_FIELDS = [
@@ -208,7 +209,7 @@ class User(models.Model):
**self.env['hr.employee']._sync_user(user)
))
if employee_create_vals:
self.env['hr.employee'].create(employee_create_vals)
self.env['hr.employee'].with_context(clean_context(self.env.context)).create(employee_create_vals)
return res
def write(self, vals):