[IMP] res_partner: more fault tolerant name_create
authorJacques-Etienne Baudoux <jba@openerp.com>
Fri, 27 Jun 2014 14:47:20 +0000 (16:47 +0200)
committerMartin Trigaux <mat@openerp.com>
Fri, 27 Jun 2014 14:48:40 +0000 (16:48 +0200)
In case of invalid format such as 'name email@server' (missing chevrons), the parsing would be failing due to a strict behaviour of getaddresses (returns nameemail@server).
With the patch this format is accepted.
opw 607312

openerp/addons/base/res/res_partner.py

index d43028d..30d79bd 100644 (file)
@@ -559,7 +559,7 @@ class res_partner(osv.osv, format_address):
         """ Supported syntax:
             - 'Raoul <raoul@grosbedon.fr>': will find name and email address
             - otherwise: default, everything is set as the name """
-        emails = tools.email_split(text)
+        emails = tools.email_split(text.replace(' ',','))
         if emails:
             email = emails[0]
             name = text[:text.index(email)].replace('"', '').replace('<', '').strip()