|
|
@ -3,12 +3,10 @@ |
|
|
|
# © 2014 Agile Business Group (<http://www.agilebg.com>) |
|
|
|
# © 2015 Grupo ESOC (<http://www.grupoesoc.es>) |
|
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|
|
|
|
|
|
|
import logging |
|
|
|
from odoo import api, fields, models |
|
|
|
from .. import exceptions |
|
|
|
|
|
|
|
|
|
|
|
_logger = logging.getLogger(__name__) |
|
|
|
|
|
|
|
|
|
|
@ -133,8 +131,17 @@ class ResPartner(models.Model): |
|
|
|
|
|
|
|
Removes leading, trailing and duplicated whitespace. |
|
|
|
""" |
|
|
|
if name: |
|
|
|
name = u" ".join(name.split(None)) |
|
|
|
try: |
|
|
|
name = u" ".join(name.split()) if name else name |
|
|
|
except UnicodeDecodeError: |
|
|
|
# with users coming from LDAP, name can be a str encoded as utf-8 |
|
|
|
# this happens with ActiveDirectory for instance, and in that case |
|
|
|
# we get a UnicodeDecodeError during the automatic ASCII -> Unicode |
|
|
|
# conversion that Python does for us. |
|
|
|
# In that case we need to manually decode the string to get a |
|
|
|
# proper unicode string. |
|
|
|
name = u' '.join(name.decode('utf-8').split()) if name else name |
|
|
|
|
|
|
|
if comma: |
|
|
|
name = name.replace(" ,", ",") |
|
|
|
name = name.replace(", ", ",") |
|
|
|