[FIX] hr: correctly format mention partner suggestions

Rev. 36f6f26 changed the format of the returned list of employees.

Javascript is expecting an array containing the array of employees,
each employee being a dict with keys id, name, email. But from rev.
36f6f26, it returned an array of employees, themselves represented
by an array containing their id, name and email.

As the format changed, the Javascript mention mechanism never used
the prefetched employees, and always fallbacked on an RPC to fetch
suggestions amongs all partners.
This commit is contained in:
Aaron Bohy
2017-01-26 09:44:57 +01:00
parent 3e31dc0ba4
commit ff613d8763
+3 -2
View File
@@ -14,8 +14,9 @@ class Partner(models.Model):
try:
employee_group = self.env.ref('base.group_user')
for user in employee_group.users:
suggestions.append((user.partner_id.id, user.name, user.email))
hr_suggestions = [{'id': user.partner_id.id, 'name': user.name, 'email': user.email}
for user in employee_group.users]
suggestions.append(hr_suggestions)
return suggestions
except AccessError:
return suggestions