diff options
| author | Xavier Dubuc <xdu@odoo.com> | 2021-03-10 16:45:49 +0000 |
|---|---|---|
| committer | Sébastien Theys <seb@odoo.com> | 2021-03-10 16:48:19 +0000 |
| commit | fbdec5fe29827b88ec0d1421f68716e1febefd89 (patch) | |
| tree | afbbc6fd6da16ace2af4c2992678657b814d0197 /addons/hr/models | |
| parent | f326ba2d14e4fdd811426c6381b7e5bc3c1d657b (diff) | |
[FIX] mail; hr: restore faster and more accurate mention suggestions
The code from v13 used to look for partners in JS before making the RPC, which
was much faster, and also gave better results by returning partners that were
already known and therefore more likely to be selected.
The same logic is reintroduced here, and further improved to take into account
all known partners and sort them according to the likeliness they will be
selected based on various criteria.
task-2413776
closes odoo/odoo#64161
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Co-authored-by: Sébastien Theys <seb@odoo.com>
Diffstat (limited to 'addons/hr/models')
| -rw-r--r-- | addons/hr/models/res_partner.py | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/addons/hr/models/res_partner.py b/addons/hr/models/res_partner.py index 22d315aa68f..e51f0069dd7 100644 --- a/addons/hr/models/res_partner.py +++ b/addons/hr/models/res_partner.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. -from odoo import api, models +from odoo import models from odoo.exceptions import AccessError @@ -9,19 +9,6 @@ class Partner(models.Model): _inherit = ['res.partner'] - @api.model - def get_static_mention_suggestions(self): - """ Extend the mail's static mention suggestions by adding the employees. """ - suggestions = super(Partner, self).get_static_mention_suggestions() - - try: - employee_group = self.env.ref('base.group_user') - 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 - def name_get(self): """ Override to allow an employee to see its private address in his profile. This avoids to relax access rules on `res.parter` and to add an `ir.rule`. |
