Skip to content
Snippets Groups Projects
Commit 05661891 authored by Nasreddin (bon)'s avatar Nasreddin (bon)
Browse files

[FIX] hr: Empty required name on quick create department


Issue

	- Open console in debugger of the browser.
	- Install "Employees" app
	- Go to "Employees" and edit or create any employee
	- In 'Department' field, quick create one

	Error is raised in console and the modal department form view is opened.

Cause

	'name' field is required but empty since 'complete_name'
	is the one set as _rec_name in 'Department' python model.

Solution

	Cherry-pick of 7c0fed48

opw-2267356

closes odoo/odoo#52468

X-original-commit: f216d3ddfac073acddb25dd8d9862f97666ee5d7
Signed-off-by: default avatarNicolas Martinelli (nim) <nim@odoo.com>
parent b28470f2
No related branches found
No related tags found
No related merge requests found
......@@ -29,6 +29,10 @@ class Department(models.Model):
return [(record.id, record.name) for record in self]
return super(Department, self).name_get()
@api.model
def name_create(self, name):
return self.create({'name': name}).name_get()[0]
@api.depends('name', 'parent_id.complete_name')
def _compute_complete_name(self):
for department in self:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment