summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/utils
diff options
context:
space:
mode:
Diffstat (limited to 'addons/mail/static/src/utils')
-rw-r--r--addons/mail/static/src/utils/utils.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/addons/mail/static/src/utils/utils.js b/addons/mail/static/src/utils/utils.js
index f502fc8f326..2cfaa531f77 100644
--- a/addons/mail/static/src/utils/utils.js
+++ b/addons/mail/static/src/utils/utils.js
@@ -4,6 +4,7 @@ odoo.define('mail/static/src/utils/utils.js', function (require) {
const { delay } = require('web.concurrency');
const {
patch: webUtilsPatch,
+ unaccent,
unpatch: webUtilsUnpatch,
} = require('web.utils');
@@ -15,6 +16,18 @@ const classPatchMap = new WeakMap();
const eventHandledWeakMap = new WeakMap();
/**
+ * Returns the given string after cleaning it. The goal of the clean is to give
+ * more convenient results when comparing it to potential search results, on
+ * which the clean should also be called before comparing them.
+ *
+ * @param {string} searchTerm
+ * @returns {string}
+ */
+function cleanSearchTerm(searchTerm) {
+ return unaccent(searchTerm.toLowerCase());
+}
+
+/**
* Executes the provided functions in order, but with a potential delay between
* them if they take too much time. This is done in order to avoid blocking the
* main thread for too long.
@@ -166,6 +179,7 @@ function unpatchInstanceMethods(Class, patchName) {
//------------------------------------------------------------------------------
return {
+ cleanSearchTerm,
executeGracefully,
isEventHandled,
markEventHandled,