summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/models/messaging_initializer/messaging_initializer.js
diff options
context:
space:
mode:
authorXavier Dubuc <xdu@odoo.com>2021-03-10 16:45:49 +0000
committerSébastien Theys <seb@odoo.com>2021-03-10 16:48:19 +0000
commitfbdec5fe29827b88ec0d1421f68716e1febefd89 (patch)
treeafbbc6fd6da16ace2af4c2992678657b814d0197 /addons/mail/static/src/models/messaging_initializer/messaging_initializer.js
parentf326ba2d14e4fdd811426c6381b7e5bc3c1d657b (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/mail/static/src/models/messaging_initializer/messaging_initializer.js')
-rw-r--r--addons/mail/static/src/models/messaging_initializer/messaging_initializer.js3
1 files changed, 1 insertions, 2 deletions
diff --git a/addons/mail/static/src/models/messaging_initializer/messaging_initializer.js b/addons/mail/static/src/models/messaging_initializer/messaging_initializer.js
index a0c8372940d..97d0d3b1e83 100644
--- a/addons/mail/static/src/models/messaging_initializer/messaging_initializer.js
+++ b/addons/mail/static/src/models/messaging_initializer/messaging_initializer.js
@@ -236,8 +236,7 @@ function factory(dependencies) {
async _initMentionPartnerSuggestions(mentionPartnerSuggestionsData) {
return executeGracefully(mentionPartnerSuggestionsData.map(suggestions => () => {
return executeGracefully(suggestions.map(suggestion => () => {
- const { email, id, name } = suggestion;
- this.env.models['mail.partner'].insert({ email, id, name });
+ this.env.models['mail.partner'].insert(this.env.models['mail.partner'].convertData(suggestion));
}));
}));
}