Commit 054bb8bc authored by Xiaowu Zhang's avatar Xiaowu Zhang

erp5_crm&tests: multi recipient and possible to select sender

parent 0289ac66
......@@ -199,7 +199,7 @@ Note:
</tr>
<tr>
<td>select</td>
<td>name=field_your_destination</td>
<td>name=field_your_destination_list</td>
<td>index=2</td>
</tr>
<tr>
......@@ -573,7 +573,7 @@ Note:
</tr>
<tr>
<td>select</td>
<td>name=field_your_destination</td>
<td>name=field_your_destination_list</td>
<td>index=4</td>
</tr>
<tr>
......
......@@ -2,10 +2,9 @@
"""
portal = context.getPortalObject()
module = portal.getDefaultModule(response_event_portal_type)
response = module.newContent(portal_type=response_event_portal_type,
source=default_destination or context.getDestination(),
destination=context.getSource(),
source=response_sender,
destination_list=response_destination_list,
resource=response_event_resource,
title=response_event_title,
text_content=response_event_text_content,
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>form_id=None, response_event_portal_type=None, response_event_resource=None, response_event_title=None, response_event_text_content=None, response_event_start_date=None, response_workflow_action=None, response_event_notification_message=None, default_destination=None, response_event_content_type=None, **kw</string> </value>
<value> <string>form_id=None, response_event_portal_type=None, response_event_resource=None, response_event_title=None, response_event_text_content=None, response_event_start_date=None, response_workflow_action=None, response_event_notification_message=None, default_destination=None, response_event_content_type=None,response_destination_list=[],response_sender=None, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
"""Returns the possible senders to choose from when creating a response event.
"""
item_list = [ ('', ''),
(context.getDestinationTitle(), context.getDestination()) ]
item_list = [ ('', '')] + [(x.getTitle(), x.getRelativeUrl()) for x in context.getDestinationValueList()]
logged_in_user = context.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue()
if logged_in_user is not None and logged_in_user.getRelativeUrl() != context.getDestination():
......
......@@ -5,8 +5,8 @@ if response_event_notification_message:
temp_event = context.getPortalObject().event_module.newContent(
temp_object=True,
portal_type=response_event_portal_type,
source=default_destination or context.getDestination(),
destination=context.getSource(),
source=response_sender,
destination_list=response_destination_list,
causality_value=context,
follow_up_list=context.getFollowUpList(),
resource=response_event_resource,
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>response_event_portal_type, response_event_notification_message, response_event_resource, response_event_text_content, response_event_content_type, default_destination, **kw</string> </value>
<value> <string>response_event_portal_type, response_event_notification_message, response_event_resource, response_event_text_content, response_event_content_type, response_sender, response_destination_list, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -103,8 +103,8 @@
<key> <string>right</string> </key>
<value>
<list>
<string>my_default_destination</string>
<string>my_default_source_title</string>
<string>your_response_sender</string>
<string>your_response_destination_list</string>
</list>
</value>
</item>
......
......@@ -10,13 +10,17 @@
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>default</string>
<string>items</string>
<string>required</string>
<string>size</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_default_source_title</string> </value>
<value> <string>your_response_destination_list</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
......@@ -41,10 +45,6 @@
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
......@@ -52,6 +52,12 @@
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
......@@ -61,7 +67,21 @@
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<key> <string>items</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>size</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
......@@ -71,21 +91,37 @@
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_event_source_title</string> </value>
<value> <string>my_multi_list_field</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewCRMFieldLibrary</string> </value>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
<key> <string>required</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>size</string> </key>
<value> <int>5</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Recipient</string> </value>
<value> <string>Recipients</string> </value>
</item>
</dictionary>
</value>
......@@ -93,4 +129,30 @@
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>here/getSource</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>here/Ticket_getArrowItemList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -19,7 +19,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_default_destination</string> </value>
<value> <string>your_response_sender</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
......@@ -75,6 +75,10 @@
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
......
......@@ -12,7 +12,7 @@ if not portal.Base_checkPermission(module.getId(), "Add portal content"):
# Create a new event
response = module.newContent(portal_type=portal_type,
source=source,
destination=destination,
destination_list=destination_list,
resource=resource,
title=title,
text_content=text_content,
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>form_id=None, portal_type=None, resource=None, title=None, text_content=None, start_date=None, event_workflow_action=None, notification_message=None, source=None, destination=None, attachment_file=None, content_type=None, workflow_action=None, **kw</string> </value>
<value> <string>form_id=None, portal_type=None, resource=None, title=None, text_content=None, start_date=None, event_workflow_action=None, notification_message=None, source=None, destination_list=[], attachment_file=None, content_type=None, workflow_action=None, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -112,7 +112,7 @@
<value>
<list>
<string>your_source</string>
<string>your_destination</string>
<string>your_destination_list</string>
<string>your_attachment_file</string>
</list>
</value>
......
......@@ -13,13 +13,14 @@
<string>default</string>
<string>items</string>
<string>required</string>
<string>size</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>your_destination</string> </value>
<value> <string>your_destination_list</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
......@@ -44,10 +45,6 @@
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
......@@ -76,7 +73,11 @@
</value>
</item>
<item>
<key> <string>target</string> </key>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>size</string> </key>
<value> <string></string> </value>
</item>
<item>
......@@ -92,11 +93,13 @@
<dictionary>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
<value>
<list/>
</value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_list_field</string> </value>
<value> <string>my_multi_list_field</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
......@@ -113,20 +116,12 @@
<value> <int>1</int> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
<key> <string>size</string> </key>
<value> <int>5</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Recipient</string> </value>
</item>
<item>
<key> <string>view_separator</string> </key>
<value> <string encoding="cdata"><![CDATA[
<br />
]]></string> </value>
<value> <string>Recipients</string> </value>
</item>
</dictionary>
</value>
......
......@@ -1637,6 +1637,8 @@ class TestCRMMailSend(BaseTestCRM):
response_event_title='Answer',
response_event_text_content='> This is an advertisement mail.',
response_workflow_action='send',
response_destination_list=['person_module/me'],
response_sender='person_module/recipient'
)
self.assertEqual(event.getSimulationState(), "delivered")
......
......@@ -6,6 +6,12 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testCRM</string> </value>
......@@ -53,13 +59,28 @@
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
......@@ -72,7 +93,7 @@
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
......@@ -81,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
......
......@@ -19,8 +19,8 @@
'field_your_response_event_resource': '',
'field_your_response_event_notification_message': '',
'field_your_response_workflow_action': 'send',
'field_my_default_destination': 'person_module/erp5_crm_ui_test_agent',
'field_your_response_event_text_content': '<p><br></p><blockquote type=&quot;cite&quot;>Hello, I have an issue</blockquote><p><br></p>'}">
'field_your_response_sender': 'person_module/erp5_crm_renderjs_ui_test_agent'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMRenderjsUi/macros/check_create_response_dialog_content" />
</tal:block>
......@@ -30,7 +30,7 @@
'field_your_response_event_start_date': '2010-01-01T00:00:00',
'field_your_response_event_notification_message': '',
'field_your_response_workflow_action': 'draft',
'field_my_default_destination': 'person_module/erp5_crm_ui_test_agent',
'field_your_response_sender': 'person_module/erp5_crm_renderjs_ui_test_agent',
'field_your_response_event_text_content': '<p>Foo<br>Bar</p>'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMRenderjsUi/macros/fill_create_response_dialog_content" />
</tal:block>
......
......@@ -19,8 +19,8 @@
'field_your_response_event_resource': '',
'field_your_response_event_notification_message': '',
'field_your_response_workflow_action': 'send',
'field_my_default_destination': 'person_module/erp5_crm_ui_test_agent',
'field_your_response_event_text_content': '<p><br></p><blockquote type=&quot;cite&quot;>Hello, I have an issue</blockquote><p><br></p>'}">
'field_your_response_sender': 'person_module/erp5_crm_renderjs_ui_test_agent'">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMRenderjsUi/macros/check_create_response_dialog_content" />
</tal:block>
......@@ -30,7 +30,7 @@
'field_your_response_event_start_date': '2010-01-01T00:00:00',
'field_your_response_event_notification_message': 'erp5_crm_ui_test_notification_reference',
'field_your_response_workflow_action': 'draft',
'field_my_default_destination': 'person_module/erp5_crm_ui_test_agent',
'field_your_response_sender': 'person_module/erp5_crm_renderjs_ui_test_agent',
'field_your_response_event_text_content': '<p>Foo<br>Bar</p>'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMRenderjsUi/macros/fill_create_response_dialog_content" />
</tal:block>
......
......@@ -19,8 +19,8 @@
'field_your_response_event_resource': '',
'field_your_response_event_notification_message': '',
'field_your_response_workflow_action': 'send',
'field_my_default_destination': 'person_module/erp5_crm_ui_test_agent',
'field_your_response_event_text_content': '<p><br></p><blockquote type=&quot;cite&quot;>Hello, I have an issue</blockquote><p><br></p>'}">
'field_your_response_sender': 'person_module/erp5_crm_renderjs_ui_test_agent'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMRenderjsUi/macros/check_create_response_dialog_content" />
</tal:block>
......@@ -30,7 +30,7 @@
'field_your_response_event_start_date': '2010-01-01T00:00:00',
'field_your_response_event_notification_message': '',
'field_your_response_workflow_action': 'draft',
'field_my_default_destination': 'person_module/erp5_crm_ui_test_agent',
'field_your_response_sender': 'person_module/erp5_crm_renderjs_ui_test_agent',
'field_your_response_event_text_content': '<p>Foo<br>Bar</p>'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMRenderjsUi/macros/fill_create_response_dialog_content" />
</tal:block>
......@@ -50,7 +50,7 @@
'field_your_response_event_start_date': '2010-01-01T00:00:00',
'field_your_response_event_notification_message': '',
'field_your_response_workflow_action': 'draft',
'field_my_default_destination': 'person_module/erp5_crm_ui_test_agent',
'field_your_response_sender': 'person_module/erp5_crm_renderjs_ui_test_agent',
'field_your_response_event_text_content': '<p>Foo<br>Bar</p>'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMRenderjsUi/macros/check_create_response_dialog_content" />
</tal:block>
......
......@@ -19,8 +19,8 @@
'field_your_response_event_resource': '',
'field_your_response_event_notification_message': '',
'field_your_response_workflow_action': 'send',
'field_my_default_destination': 'person_module/erp5_crm_ui_test_agent',
'field_your_response_event_text_content': '<p><br></p><blockquote type=&quot;cite&quot;>Hello, I have an issue</blockquote><p><br></p>'}">
'field_your_response_sender': 'person_module/erp5_crm_renderjs_ui_test_agent'">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMRenderjsUi/macros/check_create_response_dialog_content" />
</tal:block>
......@@ -30,7 +30,7 @@
'field_your_response_event_start_date': '2010-01-01T00:00:00',
'field_your_response_event_notification_message': 'erp5_crm_ui_test_notification_reference',
'field_your_response_workflow_action': 'draft',
'field_my_default_destination': 'person_module/erp5_crm_ui_test_agent',
'field_your_response_sender': 'person_module/erp5_crm_renderjs_ui_test_agent',
'field_your_response_event_text_content': '<p>Foo<br>Bar</p>'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMRenderjsUi/macros/fill_create_response_dialog_content" />
</tal:block>
......@@ -50,7 +50,7 @@
'field_your_response_event_start_date': '2010-01-01T00:00:00',
'field_your_response_event_notification_message': '',
'field_your_response_workflow_action': 'draft',
'field_my_default_destination': 'person_module/erp5_crm_ui_test_agent',
'field_your_response_sender': 'person_module/erp5_crm_renderjs_ui_test_agent',
'field_your_response_event_text_content': '<p>No pbl. We will solve your issue.</p>'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForCRMRenderjsUi/macros/check_create_response_dialog_content" />
</tal:block>
......
......@@ -147,8 +147,8 @@
</tr>
<tr>
<td>verifyValue</td>
<td>field_my_default_destination</td>
<td tal:content="python: dialog_content_configuration['field_my_default_destination']"></td>
<td>field_your_response_sender</td>
<td tal:content="python: dialog_content_configuration['field_your_response_sender']"></td>
</tr>
<tal:block tal:define="text_content python: dialog_content_configuration['field_your_response_event_text_content']">
<tal:block metal:use-macro="container/Zuite_CommonTemplateForRenderjsUi/macros/verify_ckeditor_text_content"/>
......@@ -195,8 +195,8 @@
</tr>
<tr>
<td>type</td>
<td>field_my_default_destination</td>
<td tal:content="python: dialog_content_configuration['field_my_default_destination']"></td>
<td>field_your_response_sender</td>
<td tal:content="python: dialog_content_configuration['field_your_response_sender']"></td>
</tr>
<tal:block tal:define="text_content python: dialog_content_configuration['field_your_response_event_text_content']">
<tal:block metal:use-macro="container/Zuite_CommonTemplateForRenderjsUi/macros/type_ckeditor_text_content"/>
......
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