diff options
| author | Nasreddin (bon) <bon@odoo.com> | 2020-06-04 10:51:41 +0000 |
|---|---|---|
| committer | Nasreddin (bon) <bon@odoo.com> | 2020-06-05 10:19:01 +0000 |
| commit | e6df7bb718962c01effdb68a5a8f9bd633ddb280 (patch) | |
| tree | c9e9ade405a17443d9d73a6ed19d6c1e8cff20d3 | |
| parent | 16351e48792bd35c6802646e5da38042709a785b (diff) | |
[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 7c0fed48a1479b08e3a2d526f8557d247466a547
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>
| -rw-r--r-- | addons/hr/models/hr_department.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/addons/hr/models/hr_department.py b/addons/hr/models/hr_department.py index 081318ef3e1..d65b8cb9de9 100644 --- a/addons/hr/models/hr_department.py +++ b/addons/hr/models/hr_department.py @@ -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: |
