Commit a1bfdf1b authored by Jérome Perrin's avatar Jérome Perrin

Support Request App Worklists

/reviewed-on nexedi/erp5!760
parents ca119f9c 29795b08
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
</div> </div>
<div data-gadget-url="gadget_erp5_page_form.html" data-gadget-scope="last"></div> <div data-gadget-url="gadget_erp5_page_form.html" data-gadget-scope="last"></div>
<h1 data-i18n="Support Requests" class="ui-title ui-override-theme worklist-title">Support Requests WorkList</h1> <h1 data-i18n="[value]Support Request WorkLists" class="ui-title ui-override-theme worklist-title">Support Request WorkLists</h1>
<div data-gadget-url="gadget_supportrequest_page_worklist.html" data-gadget-scope="worklist"></div> <div data-gadget-url="gadget_supportrequest_page_worklist.html" data-gadget-scope="worklist"></div>
</body> </body>
</html> </html>
...@@ -252,8 +252,8 @@ ...@@ -252,8 +252,8 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1506095040.88</float> <float>1537518325.21</float>
<string>UTC</string> <string>GMT+9</string>
</tuple> </tuple>
</state> </state>
</object> </object>
......
/*global window, rJS, RSVP, Handlebars */ /*global window, rJS, RSVP, Handlebars, Query */
/*jslint nomen: true, indent: 2, maxerr: 3 */ /*jslint nomen: true, indent: 2, maxerr: 3 */
(function (window, rJS, RSVP, Handlebars) { (function (window, rJS, RSVP, Handlebars, Query) {
"use strict"; "use strict";
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
...@@ -39,8 +39,8 @@ ...@@ -39,8 +39,8 @@
.push(function (hateoas_url) { .push(function (hateoas_url) {
return gadget.jio_getAttachment( return gadget.jio_getAttachment(
'support_request_module', 'support_request_module',
hateoas_url + 'support_request_module' hateoas_url + 'support_request_module' +
+ "/SupportRequestModule_getWorklistAsJson" '/SupportRequestModule_getWorklistAsJson'
); );
}) })
.push(function (result) { .push(function (result) {
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
} }
display_options = { display_options = {
jio_key: "support_request_module", jio_key: "support_request_module",
extended_search: result[i].query_string, extended_search: Query.objectToSearchText(result[i].query),
page: 'form', page: 'form',
view: 'view' view: 'view'
}; };
...@@ -83,4 +83,4 @@ ...@@ -83,4 +83,4 @@
}); });
}); });
}); });
}(window, rJS, RSVP, Handlebars)); }(window, rJS, RSVP, Handlebars, Query));
\ No newline at end of file \ No newline at end of file
...@@ -234,7 +234,7 @@ ...@@ -234,7 +234,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>962.26499.5927.24507</string> </value> <value> <string>962.13948.13888.3242</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -252,7 +252,7 @@ ...@@ -252,7 +252,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1506651141.01</float> <float>1506505200.17</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
"""Returns the worklists queries for ticket workflow, as a mapping where the key is the worklist ID and the value a JIO query.
This script has proxy role, as only manager can access workflow configuration.
"""
from Products.ERP5Type.Message import translateString
portal = context.getPortalObject()
query_dict = {}
workflow = portal.portal_workflow.ticket_workflow
workflow_state_var = workflow.variables.getStateVar()
for worklist in workflow.worklists.objectValues():
query_list = [{
'type': 'complex',
'operator': 'OR',
'query_list': [
{'key': 'local_roles',
'type': 'simple',
'value': role, } for role in worklist.getGuard().getRolesText().split("; ")]
}]
for key in worklist.getVarMatchKeys():
value = worklist.getVarMatch(key)
if key == workflow_state_var:
# instead of having {'validation_state': 'draft'}, we want to have
# {'translated_validation_state_title': 'Brouillon'}
# so that it looks good in the module view.
key = 'translated_%s_title' % key
state_title = workflow['states'].restrictedTraverse(value).title_or_id()
value = unicode(translateString(
'%s [state in %s]' % (state_title, workflow.getId()),
default=unicode(translateString(state_title))))
query_list.append({
'key': key,
'value': value,
'type': 'simple',
})
query_dict[worklist.getId()] = {
'type': 'complex',
'query_list': query_list
}
return query_dict
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_getTicketWorkflowWorklistInfoDict</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
from Products.ERP5Type.ImmediateReindexContextManager import ImmediateReindexContextManager
portal = context.getPortalObject() portal = context.getPortalObject()
logged_in_user_value = portal.portal_membership.getAuthenticatedMember().getUserValue() logged_in_user_value = portal.portal_membership.getAuthenticatedMember().getUserValue()
now = DateTime() now = DateTime()
# default_field_your_resource,field_your_title, description, field_your_project, default_field_your_project, form_id, field_your_resource, dialog_id, resource, title, file, project, dialog_method, field_my_description, field_your_file=None project_object = portal.project_module[project]
project_list = portal.portal_catalog(portal_type="Project", id=project) # with id keyword, this function will return a sequence data type which contains one element.
project_object = project_list[0].getObject()
with ImmediateReindexContextManager() as immediate_reindex_context_manager: support_request = portal.support_request_module.newContent(
support_request = portal.support_request_module.newContent(
immediate_reindex=immediate_reindex_context_manager,
portal_type='Support Request',
title=title,
resource="service_module/" + resource,
)
# - Reference = automatically generated - already implemented
# - Requester = current user person
# - Start date = now
# - State = submitted
# - Billing Supplier = Project related Billing Supplier
# - Location = Project related Location
# - Supervisor = Project related Supervisor
support_request = portal.support_request_module.newContent(
portal_type='Support Request', portal_type='Support Request',
title=title, title=title,
resource="service_module/" + resource, resource="service_module/" + resource,
...@@ -34,10 +15,9 @@ with ImmediateReindexContextManager() as immediate_reindex_context_manager: ...@@ -34,10 +15,9 @@ with ImmediateReindexContextManager() as immediate_reindex_context_manager:
source_project_value = project_object, source_project_value = project_object,
destination_value = project_object.getDestinationValue(), destination_value = project_object.getDestinationValue(),
start_date=now, start_date=now,
) )
support_request.submit() support_request.submit()
if description is not None or file is not None: if description is not None or file is not None:
portal.post_module.PostModule_createHTMLPostForSupportRequest( portal.post_module.PostModule_createHTMLPostForSupportRequest(
......
# return worklists from ticket workflow in JSON format
from Products.ERP5Type.Message import translateString
import json import json
portal = context.getPortalObject() portal = context.getPortalObject()
count_list = []
state_dict = {
"submitted": "Support Request to Open",
"draft": "Support Request to Submit",
"validated": "Support Request to Close",
"suspended": "Suspended Support Requests"
}
# XXX hardcoded, these lines below reflect portal_workflow/ticket_workflow worklists worklist_query_dict = portal.ERP5Site_getTicketWorkflowWorklistInfoDict()
count_list.append({
'query_string': 'portal_type:"Support Request" AND simulation_state:"draft" AND local_roles:"Owner"', # Query portal actions to get the worklist count and
'action_name': state_dict["draft"], # extend this information with the query from our helper script.
'action_count': portal.support_request_module.countFolder(portal_type="Support Request", simulation_state="draft", local_roles="Owner")[0][0]}) worklist_action_list = [
count_list.append({ {
'query_string': 'portal_type:"Support Request" AND simulation_state:"submitted" AND local_roles:"Assignor"', 'action_name': unicode(translateString(action['name'].rsplit(' (', 1)[0])), # Action name include the count, but we display it separatly.
'action_name': state_dict["submitted"], 'action_count': action['count'],
'action_count': portal.support_request_module.countFolder(portal_type="Support Request", simulation_state="submitted", local_roles="Assignor")[0][0]}) 'query': worklist_query_dict[action['worklist_id']],
count_list.append({ }
'query_string': 'portal_type:"Support Request" AND simulation_state:"validated" AND local_roles:("Assignee" OR "Assignor")', for action in portal.portal_actions.listFilteredActionsFor(context)['global']
'action_name': state_dict["validated"], if action['category'] == 'global' and action.get('workflow_id') == 'ticket_workflow'
'action_count': portal.support_request_module.countFolder(portal_type="Support Request", simulation_state="validated", local_roles=("Assignee", "Assignor"))[0][0]}) ]
count_list.append({
'query_string': 'portal_type:"Support Request" AND simulation_state:"suspended" AND local_roles:("Assignee" OR "Assignor")',
'action_name': state_dict["suspended"],
'action_count': portal.support_request_module.countFolder(portal_type="Support Request", simulation_state="suspended", local_roles=("Assignee", "Assignor"))[0][0]})
return json.dumps(count_list) return json.dumps(worklist_action_list)
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testWorklist</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode>Worklists on support request front page</unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<html>
<head>
<title tal:content="template/title">Worklists on support request front page</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">Worklists on support request front page</td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" />
<tal:block metal:use-macro="here/Zuite_SupportRequestUITemplate/macros/cleanup_module" />
<tal:block metal:use-macro="here/Zuite_SupportRequestUITemplate/macros/create_data" />
<tr>
<td>open</td>
<td>${base_url}/web_site_module/erp5_officejs_support_request_ui/</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//h1[@data-i18n="[value]Support Request WorkLists"]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//section[@class="document_list"]//li[1]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//section[@class="document_list"]//li/a[contains(text(), "Support Requests to Open")]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td> <!-- document count -->
<td>//section[@class="document_list"]//li/a[contains(text(), "Support Requests to Open")]/span[text() = "1"]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//section[@class="document_list"]//li/a[contains(text(), "Support Requests to Close")]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//section[@class="document_list"]//li/a[contains(text(), "Support Requests to Close")]/span[text() = "1"]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//section[@class="document_list"]//li/a[contains(text(), "Suspended Support Requests")]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//section[@class="document_list"]//li/a[contains(text(), "Suspended Support Requests")]/span[text() = "1"]</td>
<td></td>
</tr>
<!-- clicking on one worklist open the module -->
<tr>
<td>click</td>
<td>//section[@class="document_list"]//li/a[contains(text(), "Suspended Support Requests")]/span[text() = "1"]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//h1/a[@data-i18n="Support Request Module"]</td>
<td></td>
</tr>
<!-- The module is filtered according to worklist definition, so it shows one document -->
<tr>
<td>waitForElementPresent</td>
<td>//h1[@data-i18n="Support Requests"]//span[text() = "(1)"]</td>
<td></td>
</tr>
<!-- Query editor buttons are also present -->
<tr>
<td>waitForElementPresent</td>
<td>div.search_parsed_value > button:nth-of-type(3)</td>
</tr>
</tbody></table>
</body>
</html>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Zuite" module="Products.Zelenium.zuite"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>zzz_logout_test</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Tests which logs out the default manager user, put in this folder so that they run at the end)</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
<key> <string>_Add_portal_content_Permission</string> </key> <key> <string>_Add_portal_content_Permission</string> </key>
<value> <value>
<tuple> <tuple>
<string>Assignee</string>
<string>Assignor</string> <string>Assignor</string>
<string>Manager</string> <string>Manager</string>
</tuple> </tuple>
...@@ -30,6 +31,7 @@ ...@@ -30,6 +31,7 @@
<key> <string>_Modify_portal_content_Permission</string> </key> <key> <string>_Modify_portal_content_Permission</string> </key>
<value> <value>
<tuple> <tuple>
<string>Assignee</string>
<string>Assignor</string> <string>Assignor</string>
<string>Manager</string> <string>Manager</string>
</tuple> </tuple>
...@@ -246,11 +248,11 @@ ...@@ -246,11 +248,11 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>action</string> </key> <key> <string>action</string> </key>
<value> <string>submit</string> </value> <value> <string>suspend</string> </value>
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>jc</string> </value> <value> <string>ERP5TypeTestCase</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -258,7 +260,7 @@ ...@@ -258,7 +260,7 @@
</item> </item>
<item> <item>
<key> <string>simulation_state</string> </key> <key> <string>simulation_state</string> </key>
<value> <string>submitted</string> </value> <value> <string>suspended</string> </value>
</item> </item>
<item> <item>
<key> <string>time</string> </key> <key> <string>time</string> </key>
...@@ -272,7 +274,7 @@ ...@@ -272,7 +274,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1503318144.34</float> <float>1536287646.96</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
<tuple> <tuple>
<string>Assignee</string> <string>Assignee</string>
<string>Assignor</string> <string>Assignor</string>
<string>Associate</string>
<string>Auditor</string> <string>Auditor</string>
<string>Manager</string> <string>Manager</string>
</tuple> </tuple>
...@@ -21,6 +22,7 @@ ...@@ -21,6 +22,7 @@
<key> <string>_Add_portal_content_Permission</string> </key> <key> <string>_Add_portal_content_Permission</string> </key>
<value> <value>
<tuple> <tuple>
<string>Assignee</string>
<string>Assignor</string> <string>Assignor</string>
<string>Manager</string> <string>Manager</string>
</tuple> </tuple>
...@@ -30,6 +32,7 @@ ...@@ -30,6 +32,7 @@
<key> <string>_Modify_portal_content_Permission</string> </key> <key> <string>_Modify_portal_content_Permission</string> </key>
<value> <value>
<tuple> <tuple>
<string>Assignee</string>
<string>Assignor</string> <string>Assignor</string>
<string>Manager</string> <string>Manager</string>
</tuple> </tuple>
...@@ -41,6 +44,7 @@ ...@@ -41,6 +44,7 @@
<tuple> <tuple>
<string>Assignee</string> <string>Assignee</string>
<string>Assignor</string> <string>Assignor</string>
<string>Associate</string>
<string>Auditor</string> <string>Auditor</string>
<string>Manager</string> <string>Manager</string>
</tuple> </tuple>
...@@ -246,11 +250,11 @@ ...@@ -246,11 +250,11 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>action</string> </key> <key> <string>action</string> </key>
<value> <string>submit</string> </value> <value> <string>validate</string> </value>
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>dt</string> </value> <value> <string>ERP5TypeTestCase</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -258,7 +262,7 @@ ...@@ -258,7 +262,7 @@
</item> </item>
<item> <item>
<key> <string>simulation_state</string> </key> <key> <string>simulation_state</string> </key>
<value> <string>submitted</string> </value> <value> <string>validated</string> </value>
</item> </item>
<item> <item>
<key> <string>time</string> </key> <key> <string>time</string> </key>
...@@ -272,7 +276,7 @@ ...@@ -272,7 +276,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1503068817.98</float> <float>1536287429.38</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
<tuple> <tuple>
<string>Assignee</string> <string>Assignee</string>
<string>Assignor</string> <string>Assignor</string>
<string>Associate</string>
<string>Auditor</string> <string>Auditor</string>
<string>Manager</string> <string>Manager</string>
</tuple> </tuple>
...@@ -21,7 +22,6 @@ ...@@ -21,7 +22,6 @@
<key> <string>_Add_portal_content_Permission</string> </key> <key> <string>_Add_portal_content_Permission</string> </key>
<value> <value>
<tuple> <tuple>
<string>Assignor</string>
<string>Manager</string> <string>Manager</string>
</tuple> </tuple>
</value> </value>
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
<key> <string>_Modify_portal_content_Permission</string> </key> <key> <string>_Modify_portal_content_Permission</string> </key>
<value> <value>
<tuple> <tuple>
<string>Assignor</string>
<string>Manager</string> <string>Manager</string>
</tuple> </tuple>
</value> </value>
...@@ -41,6 +40,7 @@ ...@@ -41,6 +40,7 @@
<tuple> <tuple>
<string>Assignee</string> <string>Assignee</string>
<string>Assignor</string> <string>Assignor</string>
<string>Associate</string>
<string>Auditor</string> <string>Auditor</string>
<string>Manager</string> <string>Manager</string>
</tuple> </tuple>
...@@ -212,11 +212,11 @@ ...@@ -212,11 +212,11 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>action</string> </key> <key> <string>action</string> </key>
<value> <string>submit</string> </value> <value> <string>invalidate</string> </value>
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>dt</string> </value> <value> <string>ERP5TypeTestCase</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -224,7 +224,7 @@ ...@@ -224,7 +224,7 @@
</item> </item>
<item> <item>
<key> <string>simulation_state</string> </key> <key> <string>simulation_state</string> </key>
<value> <string>submitted</string> </value> <value> <string>invalidated</string> </value>
</item> </item>
<item> <item>
<key> <string>time</string> </key> <key> <string>time</string> </key>
...@@ -238,7 +238,7 @@ ...@@ -238,7 +238,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1503418768.34</float> <float>1536287473.89</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
"""Cleanup the data from support request module.
So that test are isolated.
"""
from Products.ZSQLCatalog.SQLCatalog import Query, NegatedQuery
portal = context.getPortalObject()
test_project_set = set((
portal.project_module.erp5_officejs_support_request_ui_test_project_001,
portal.project_module.erp5_officejs_support_request_ui_test_project_002))
to_delete_list = []
for brain in portal.portal_catalog(
portal_type="Support Request",
simulation_state=NegatedQuery(Query(simulation_state=("cancelled",)))):
support_request = brain.getObject()
if support_request.getId().startswith('erp5_officejs_support_request_ui_test_'):
continue # business template data
assert support_request.getSourceProjectValue() in test_project_set, \
"Support request %s have unexpected project." % support_request.absolute_url()
to_delete_list.append(support_request.getId())
portal.support_request_module.manage_delObjects(to_delete_list)
# Clear worklist cache
portal.portal_caches.clearAllCache()
return "Done."
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_cleanupSupportRequestUITestDataSet</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
"""Create some data for support request UI test.
Logged in user needs to be Assignee / Assignor on the support requests
included in business template.
"""
portal = context.getPortalObject()
for support_request in portal.support_request_module.contentValues():
if support_request.getId().startswith('erp5_officejs_support_request_ui_test'):
support_request.manage_addLocalRoles(
portal.portal_membership.getAuthenticatedMember().getId(),
['Assignee', 'Assignor'])
support_request.reindexObject()
portal.portal_caches.clearAllCache()
return "Done."
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_createSupportRequestUITestDataSet</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Zuite_SupportRequestUITemplate</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<tal:block xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal">
<tal:block metal:define-macro="cleanup_module">
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/wait_for_activities" />
<tr><td>openAndWait</td>
<td>${base_url}/ERP5Site_cleanupSupportRequestUITestDataSet</td><td></td></tr>
<tr><td>assertTextPresent</td>
<td>Done.</td><td></td></tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/wait_for_activities" />
</tal:block>
<tal:block metal:define-macro="create_data">
<tr><td>openAndWait</td>
<td>${base_url}/ERP5Site_createSupportRequestUITestDataSet</td><td></td></tr>
<tr><td>assertTextPresent</td>
<td>Done.</td><td></td></tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/wait_for_activities" />
</tal:block>
</tal:block>
\ No newline at end of file
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