Commit da6274f6 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

erp5_crm: keep order in Base_getEntityListFromFromHeader.

parent f48ac36e
Pipeline #36232 failed with stage
in 0 seconds
from collections import OrderedDict
getResultValue = context.portal_catalog.getResultValue getResultValue = context.portal_catalog.getResultValue
from Products.ERP5Type.Utils import Email_parseAddressHeader from Products.ERP5Type.Utils import Email_parseAddressHeader
result = set() result = OrderedDict()
for _, recipient in set(Email_parseAddressHeader(text)): for recipient in OrderedDict((x[1], True) for x in Email_parseAddressHeader(text)):
if recipient: if recipient:
email = getResultValue(url_string={'query':recipient, 'key':'ExactMatch'}, portal_type='Email', parent_portal_type='Person') email = getResultValue(url_string={'query':recipient, 'key':'ExactMatch'}, portal_type='Email', parent_portal_type='Person')
if email is None: if email is None:
email = getResultValue(url_string={'query':recipient, 'key':'ExactMatch'}, portal_type='Email', parent_portal_type='Organisation') email = getResultValue(url_string={'query':recipient, 'key':'ExactMatch'}, portal_type='Email', parent_portal_type='Organisation')
if email is not None: if email is not None:
result.add(email.getParentValue()) result[email.getParentValue()] = True
return list(result) 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