Commit 53fbcf21 authored by Jérome Perrin's avatar Jérome Perrin

NotificationTool: import a temp constructor with same name as notifier portal type

parent 31405035
...@@ -348,13 +348,17 @@ class NotificationTool(BaseTool): ...@@ -348,13 +348,17 @@ class NotificationTool(BaseTool):
event_keyword_argument_dict = {} event_keyword_argument_dict = {}
for notifier in notifier_list: for notifier in notifier_list:
if notifier in available_notifier_list: if notifier in available_notifier_list:
event = self.getDefaultModule(notifier).newContent(portal_type=notifier, event = portal.getDefaultModule(notifier).newContent(portal_type=notifier,
temp_object=not store_as_event, temp_object=not store_as_event,
**event_keyword_argument_dict) **event_keyword_argument_dict)
else: else:
from Products.ERP5Type.Document import newTempEvent # portal type does not exist, likely erp5_crm is not installed. Try to
event = newTempEvent(self, '_', # import the class with the same name.
**event_keyword_argument_dict) from Products.ERP5Type import Document as document_module
constructor = getattr(document_module,
'newTemp%s' % notifier.replace(' ', ''))
event = constructor(self, '_', **event_keyword_argument_dict)
event.setSourceValue(from_person) event.setSourceValue(from_person)
event.setDestinationValueList(to_person_list) event.setDestinationValueList(to_person_list)
event.setTitle(subject) event.setTitle(subject)
......
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