Commit 4dd349a0 authored by wenjie.zheng's avatar wenjie.zheng

ERP5TypeTestCase.py: just want to commit.

parent 4129833b
......@@ -787,7 +787,6 @@ class ERP5TypeCommandLineTestCase(ERP5TypeTestCaseMixin):
light_install = self.enableLightInstall()
create_activities = self.enableActivityTool()
hot_reindexing = self.enableHotReindexing()
# install erp5_workflow to allow early stage workflow migration.
for x, y in (("erp5_core_proxy_field_legacy", "erp5_base"),
("erp5_stock_cache", "erp5_pdm")):
if x not in template_list:
......@@ -795,10 +794,13 @@ class ERP5TypeCommandLineTestCase(ERP5TypeTestCaseMixin):
template_list.insert(template_list.index(y), x)
except ValueError:
pass
# install erp5_workflow to allow early stage workflow migration.
if 'erp5_base' in template_list:
template_list.insert(template_list.index('erp5_base')+1, 'erp5_workflow')
else:
template_list.append('erp5_workflow')
self.setUpERP5Site(business_template_list=template_list,
light_install=light_install,
create_activities=create_activities,
......@@ -921,13 +923,15 @@ class ERP5TypeCommandLineTestCase(ERP5TypeTestCaseMixin):
if not quiet:
ZopeTestCase._print('done (%.3fs)\n' % (time.time() - start))
def dynamicalWorkflowConversion(self):
def dynamicWorkflowConversion(self):
# Converting DCWorkflow dynamically
workflow_tool = self.portal.portal_workflow
type_value_list = []
if workflow_tool.getPortalType() == "Workflow Tool":
type_workflow_dict = workflow_tool.getChainsByType()
for workflow_id in workflow_tool.objectIds():
start = DateTime()
LOG(" ===== dynamicalWorkflowConvertion ", 0, " in ERP5TypeTestCase.py 932.")
# Do not convert workflow's live test related workflows.
if workflow_id in ['testing_workflow', 'testing_interaction_workflow',\
'testing_workflow_backup', 'testing_interaction_workflow_backup']:
......@@ -936,15 +940,17 @@ class ERP5TypeCommandLineTestCase(ERP5TypeTestCaseMixin):
if workflow.getPortalType() not in ['Workflow', 'Interaction Workflow']:
new_workflow = workflow_tool.dc_workflow_asERP5Object(workflow_tool, workflow, temp=0)
for ptype_id in type_workflow_dict:
ptype = getattr(self.portal.portal_types, ptype_id, None)
if ptype is not None and workflow_id in workflow_tool.getChainsByType()[ptype_id]:
ptype = self.portal.portal_types._getOb(ptype_id, None)
if ptype is not None and workflow_id in type_workflow_dict[ptype_id]:
# 1. clean DC workflow assignement:
workflow_tool.delTypeCBT(ptype_id, workflow_id)
# 2. assign ERP5 Workflow to portal type:
if workflow_id not in ptype.getTypeWorkflowList():
ptype.addTypeWorkflowList(workflow_id)
LOG(" | Add workflow '%s' to type '%s'"%(workflow_id, ptype_id),0," in ERP5TypeTestCase.py 946")
if ptype not in type_value_list:
type_value_list.append(ptype)
LOG(" | converting '%s' takes '%s')"%(workflow_id, (DateTime()-start)*86400),0," in ERP5TypeTestCase.py 951")
# force convert edit_workflow: Why have to load edit_workflow this way?
edit_workflow = workflow_tool._getOb('edit_workflow', None)
if edit_workflow is not None:
......@@ -955,7 +961,7 @@ class ERP5TypeCommandLineTestCase(ERP5TypeTestCaseMixin):
workflow_tool.delTypeCBT(ptype_id, 'edit_workflow')
if 'edit_workflow' not in ptype.getTypeWorkflowList():
ptype.addTypeWorkflowList('edit_workflow')
# respect the original workflow order
# Reset the original workflows assignement order.
for type_value in type_value_list:
type_value.workflow_list = tuple(reversed(type_value.workflow_list))
......@@ -1064,8 +1070,9 @@ class ERP5TypeCommandLineTestCase(ERP5TypeTestCaseMixin):
if hot_reindexing:
setattr(app,'isIndexable', 1)
portal.portal_catalog.manage_hotReindexAll()
self.dynamicalWorkflowConversion()
portal.portal_types.resetDynamicDocumentsOnceAtTransactionBoundary()
LOG(" ***** dynamicWorkflowConversion ***** ",0," in ERP5TypeTestCase.py 1070.")
self.dynamicWorkflowConversion()
self.getPortal().erp5_sql_connection.manage_test("update message_queue set processing_node=0, priority=1 where processing_node=-1")
self.getPortal().erp5_sql_connection.manage_test("update message set processing_node=0, priority=2 where processing_node=-1")
self.tic(not quiet)
......
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