Commit e5dfa780 authored by Sebastien Robin's avatar Sebastien Robin

crm: in dialog creating event from person module, fix incoming event creation

the event_workflow does no longer make a difference between incoming
and outgoing messages. Fixed creation of incoming events and add test
to check them to prevent future regression
parent 3270183e
......@@ -84,11 +84,10 @@ if not single_event:\n
if direction == \'incoming\':\n
event.setSourceValue(person.getObject())\n
event.setDestinationValue(user_person)\n
event.receive()\n
else:\n
event.setDestinationValue(person.getObject())\n
event.setSourceValue(user_person)\n
event.plan()\n
event.plan()\n
event_list.append(event)\n
else:\n
if direction == \'incoming\' and len(person_list) > 1:\n
......
663
\ No newline at end of file
664
\ No newline at end of file
......@@ -185,7 +185,7 @@ class TestCRM(BaseTestCRM):
description='New Desc',
direction='incoming')
def test_PersonModule_CreateRelatedEventSelectionParams(self):
def checkCreateRelatedEventSelectionParamsOnPersonModule(self, direction):
# create related event from selected persons.
person_module = self.portal.person_module
pers1 = person_module.newContent(portal_type='Person', title='Pers1')
......@@ -200,7 +200,7 @@ class TestCRM(BaseTestCRM):
person_module.PersonModule_newEvent(portal_type='Mail Message',
title='The Event Title',
description='The Event Descr.',
direction='outgoing',
direction=direction,
selection_name='person_module_selection',
follow_up='',
text_content='Event Content',
......@@ -208,17 +208,26 @@ class TestCRM(BaseTestCRM):
self.tic()
related_event = pers1.getDestinationRelatedValue(
portal_type='Mail Message')
if direction == "outgoing":
getter_id = "getDestinationRelatedValue"
elif direction == "incoming":
getter_id = "getSourceRelatedValue"
related_event = getattr(pers1, getter_id)(portal_type='Mail Message')
self.assertNotEquals(None, related_event)
self.assertEquals('The Event Title', related_event.getTitle())
self.assertEquals('The Event Descr.', related_event.getDescription())
self.assertEquals('Event Content', related_event.getTextContent())
for person in (pers2, pers3):
self.assertEquals(None, person.getDestinationRelatedValue(
self.assertEquals(None, getattr(person, getter_id)(
portal_type='Mail Message'))
def test_PersonModule_CreateOutgoingRelatedEventSelectionParams(self):
self.checkCreateRelatedEventSelectionParamsOnPersonModule('outgoing')
def test_PersonModule_CreateIncomingRelatedEventSelectionParams(self):
self.checkCreateRelatedEventSelectionParamsOnPersonModule('incoming')
def test_PersonModule_CreateRelatedEventCheckedUid(self):
# create related event from selected persons.
person_module = self.portal.person_module
......
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