summaryrefslogtreecommitdiff
path: root/addons/mail/models/mail_alias.py
diff options
context:
space:
mode:
authorThibault Delavallée <tde@odoo.com>2018-01-03 12:39:08 +0100
committerThibault Delavallée <tde@odoo.com>2018-01-11 11:52:37 +0100
commitcdfe479e2e92b8bfc4e4d5bb32c1db8ad5c431d6 (patch)
tree76b793c56dc98bed3c8fcafc7ecf1a9fa7daf036 /addons/mail/models/mail_alias.py
parent782154da11975b9db4620d7d39df3b567f3abcdc (diff)
[MOV] mail: reorder a bit mail thread methods by category
As this class has grown a lot some methods have been put a bit anywhere in the file. To prepare future improvements it is easier to regroup them a bit. remove_accent from mail_alias is also moved to tools in order to separate tools from business or class specific code.
Diffstat (limited to 'addons/mail/models/mail_alias.py')
-rw-r--r--addons/mail/models/mail_alias.py13
1 files changed, 1 insertions, 12 deletions
diff --git a/addons/mail/models/mail_alias.py b/addons/mail/models/mail_alias.py
index dc09f3be13b..2594d3162e0 100644
--- a/addons/mail/models/mail_alias.py
+++ b/addons/mail/models/mail_alias.py
@@ -3,26 +3,15 @@
import logging
import re
-import unicodedata
from odoo import _, api, fields, models
from odoo.exceptions import ValidationError
-from odoo.tools import ustr
+from odoo.tools import remove_accents
from odoo.tools.safe_eval import safe_eval
_logger = logging.getLogger(__name__)
-# Inspired by http://stackoverflow.com/questions/517923
-def remove_accents(input_str):
- """Suboptimal-but-better-than-nothing way to replace accented
- latin letters by an ASCII equivalent. Will obviously change the
- meaning of input_str and work only for some cases"""
- input_str = ustr(input_str)
- nkfd_form = unicodedata.normalize('NFKD', input_str)
- return u''.join([c for c in nkfd_form if not unicodedata.combining(c)])
-
-
class Alias(models.Model):
"""A Mail Alias is a mapping of an email address with a given Odoo Document
model. It is used by Odoo's mail gateway when processing incoming emails