From 9b53cbe575580ca61bf0ef17edbc081222c53c33 Mon Sep 17 00:00:00 2001 From: Kevin Baptiste Date: Mon, 11 Apr 2022 06:44:37 +0000 Subject: [PATCH] [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 --- addons/hr/models/res_users.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/hr/models/res_users.py b/addons/hr/models/res_users.py index 4b142772540..8123aa54bec 100644 --- a/addons/hr/models/res_users.py +++ b/addons/hr/models/res_users.py @@ -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):