[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 7c0fed48a1
opw-2267356
closes odoo/odoo#52489
X-original-commit: 056618914e9f1f437f8855459c302fc0ac6663c5
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Signed-off-by: bon-odoo <nboulif@users.noreply.github.com>
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user