Commit da6274f6 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

erp5_crm: keep order in Base_getEntityListFromFromHeader.

parent f48ac36e
from collections import OrderedDict
getResultValue = context.portal_catalog.getResultValue
from Products.ERP5Type.Utils import Email_parseAddressHeader
result = set()
for _, recipient in set(Email_parseAddressHeader(text)):
result = OrderedDict()
for recipient in OrderedDict((x[1], True) for x in Email_parseAddressHeader(text)):
if recipient:
email = getResultValue(url_string={'query':recipient, 'key':'ExactMatch'}, portal_type='Email', parent_portal_type='Person')
if email is None:
email = getResultValue(url_string={'query':recipient, 'key':'ExactMatch'}, portal_type='Email', parent_portal_type='Organisation')
if email is not None:
result.add(email.getParentValue())
result[email.getParentValue()] = True
return list(result)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment