Commit c50c76a4 authored by Arnaud Fontaine's avatar Arnaud Fontaine

WIP

parent b6ababa1
...@@ -43,6 +43,21 @@ END_STATE_TITLE = 'End' ...@@ -43,6 +43,21 @@ END_STATE_TITLE = 'End'
## TODO-ERP5Workflow: Initially part of Workflow implementation done for ## TODO-ERP5Workflow: Initially part of Workflow implementation done for
## ERP5Configurator but not used by ERP5 Workflow... ## ERP5Configurator but not used by ERP5 Workflow...
def initializeDocument(workflow, document):
"""
Set initial state on the Document
"""
state_bc_id = workflow.getStateBaseCategory()
document.setCategoryMembership(state_bc_id, workflow.getSource())
object = workflow.getStateChangeInformation(document, workflow.getSourceValue())
# Initialize workflow history
status_dict = {state_bc_id: workflow.getSource()}
variable_list = workflow.contentValues(portal_type='Workflow Variable')
for variable in variable_list:
status_dict[variable.getTitle()] = variable.getVariableValue(object=object)
workflow._updateWorkflowHistory(document, status_dict)
def _generateHistoryKey(workflow): def _generateHistoryKey(workflow):
""" """
Generate a key used in the workflow history. Generate a key used in the workflow history.
......
...@@ -62,6 +62,18 @@ class CategoryTool(CMFCategoryTool, BaseTool): ...@@ -62,6 +62,18 @@ class CategoryTool(CMFCategoryTool, BaseTool):
objectValues = BaseTool.objectValues objectValues = BaseTool.objectValues
def _isBootstrapRequired(self):
return 'before_script' not in self
def _bootstrap(self):
from Products.ERP5.ERP5Site import ERP5Generator
ERP5Generator.bootstrap(self, 'erp5_core', 'CategoryTemplateItem', (
'before_script',
'before_commit_script',
'activate_script',
'after_script',
))
# Filter content (ZMI)) # Filter content (ZMI))
def filtered_meta_types(self, user=None): def filtered_meta_types(self, user=None):
# Filters the list of available meta types. # Filters the list of available meta types.
......
...@@ -497,6 +497,9 @@ class ERP5TypeInformation(XMLObject, ...@@ -497,6 +497,9 @@ class ERP5TypeInformation(XMLObject,
"""Getter for 'type_workflow' property""" """Getter for 'type_workflow' property"""
return list(self.workflow_list) return list(self.workflow_list)
def _setTypeWorkflowList(self, type_workflow_list):
self.workflow_list = type_workflow_list
security.declareProtected(Permissions.ModifyPortalContent, security.declareProtected(Permissions.ModifyPortalContent,
'setTypeWorkflowList') 'setTypeWorkflowList')
def setTypeWorkflowList(self, type_workflow_list): def setTypeWorkflowList(self, type_workflow_list):
......
...@@ -67,7 +67,7 @@ class PropertySheetTool(BaseTool): ...@@ -67,7 +67,7 @@ class PropertySheetTool(BaseTool):
'template_tool_component_id_property') 'template_tool_component_id_property')
def _isBootstrapRequired(self): def _isBootstrapRequired(self):
if not self.has_key('BaseType'): if not self.has_key('Interaction'):
return True return True
bt_has_key = self.BusinessTemplate.has_key bt_has_key = self.BusinessTemplate.has_key
......
...@@ -101,7 +101,7 @@ class TypesTool(TypeProvider): ...@@ -101,7 +101,7 @@ class TypesTool(TypeProvider):
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
def _isBootstrapRequired(self): def _isBootstrapRequired(self):
if not self.has_key('Standard Property'): if not self.has_key('Interaction Workflow'):
return True return True
# bootstrap is not required, but we may have a few bugfixes to apply # bootstrap is not required, but we may have a few bugfixes to apply
# so that the user can upgrade Business Templates # so that the user can upgrade Business Templates
...@@ -133,7 +133,11 @@ class TypesTool(TypeProvider): ...@@ -133,7 +133,11 @@ class TypesTool(TypeProvider):
'Standard Property', 'Standard Property',
'Acquired Property', 'Acquired Property',
# workflow (initializePortalTypeDynamicWorkflowMethods) # workflow (initializePortalTypeDynamicWorkflowMethods)
'State',
'Transition', 'Transition',
'Workflow Script',
'Workflow Variable',
'Worklist',
'Workflow', 'Workflow',
'Interaction', 'Interaction',
'Interaction Workflow', 'Interaction Workflow',
...@@ -143,6 +147,8 @@ class TypesTool(TypeProvider): ...@@ -143,6 +147,8 @@ class TypesTool(TypeProvider):
'Catalog Tool', 'Catalog Tool',
)) ))
ERP5Generator.bootstrap_allow_type(self, 'Catalog Tool') ERP5Generator.bootstrap_allow_type(self, 'Catalog Tool')
ERP5Generator.bootstrap_allow_type(self, 'Workflow')
ERP5Generator.bootstrap_allow_type(self, 'Interaction Workflow')
def listContentTypes(self, container=None): def listContentTypes(self, container=None):
"""List content types from all providers """List content types from all providers
......
...@@ -434,10 +434,11 @@ def synchronizeDynamicModules(context, force=False): ...@@ -434,10 +434,11 @@ def synchronizeDynamicModules(context, force=False):
from Products.ERP5Type.Tool.PropertySheetTool import PropertySheetTool from Products.ERP5Type.Tool.PropertySheetTool import PropertySheetTool
from Products.ERP5Type.Tool.TypesTool import TypesTool from Products.ERP5Type.Tool.TypesTool import TypesTool
from Products.ERP5Type.Tool.ComponentTool import ComponentTool from Products.ERP5Type.Tool.ComponentTool import ComponentTool
from Products.ERP5.Tool.CategoryTool import CategoryTool
from Products.ERP5Type.Tool.WorkflowTool import WorkflowTool from Products.ERP5Type.Tool.WorkflowTool import WorkflowTool
from Products.ERP5Catalog.Tool.ERP5CatalogTool import ERP5CatalogTool from Products.ERP5Catalog.Tool.ERP5CatalogTool import ERP5CatalogTool
try: try:
for tool_class in TypesTool, PropertySheetTool, ComponentTool, ERP5CatalogTool, WorkflowTool: for tool_class in TypesTool, PropertySheetTool, ComponentTool, ERP5CatalogTool, CategoryTool, WorkflowTool:
# if the instance has no property sheet tool, or incomplete # if the instance has no property sheet tool, or incomplete
# property sheets, we need to import some data to bootstrap # property sheets, we need to import some data to bootstrap
# (only likely to happen on the first run ever) # (only likely to happen on the first run ever)
......
...@@ -1229,7 +1229,8 @@ def convertToERP5Workflow(self, temp_object=False): ...@@ -1229,7 +1229,8 @@ def convertToERP5Workflow(self, temp_object=False):
trash_tool = getattr(portal, 'portal_trash', None) trash_tool = getattr(portal, 'portal_trash', None)
if trash_tool is not None: if trash_tool is not None:
# move old workflow to trash tool; # move old workflow to trash tool;
LOG(" | Move old workflow '%s' into a trash bin", 0, self.id) LOG("convertToERP5Workflow", 0,
"Move old workflow '%s' into a trash bin" % self.id)
workflow_tool._delOb(self.id) workflow_tool._delOb(self.id)
from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod
trashbin = UnrestrictedMethod(trash_tool.newTrashBin)(self.id) trashbin = UnrestrictedMethod(trash_tool.newTrashBin)(self.id)
......
...@@ -205,6 +205,7 @@ def WorkflowTool_bootstrap(self): ...@@ -205,6 +205,7 @@ def WorkflowTool_bootstrap(self):
WorkflowTool._isBootstrapRequired = WorkflowTool_isBootstrapRequired WorkflowTool._isBootstrapRequired = WorkflowTool_isBootstrapRequired
WorkflowTool._bootstrap = WorkflowTool_bootstrap WorkflowTool._bootstrap = WorkflowTool_bootstrap
WorkflowTool.getWorkflowValueListFor = WorkflowTool.getWorkflowsFor
def _deleteChainsByType(self, pt, wf_id): def _deleteChainsByType(self, pt, wf_id):
self._chains_by_type[pt] = tuple(wf for wf in self._chains_by_type[pt] if wf!=wf_id) self._chains_by_type[pt] = tuple(wf for wf in self._chains_by_type[pt] if wf!=wf_id)
......
...@@ -944,14 +944,6 @@ class ERP5TypeCommandLineTestCase(ERP5TypeTestCaseMixin): ...@@ -944,14 +944,6 @@ class ERP5TypeCommandLineTestCase(ERP5TypeTestCaseMixin):
light_install = self.enableLightInstall() light_install = self.enableLightInstall()
create_activities = self.enableActivityTool() create_activities = self.enableActivityTool()
hot_reindexing = self.enableHotReindexing() hot_reindexing = self.enableHotReindexing()
for x, y in (("erp5_core_proxy_field_legacy", "erp5_base"),
("erp5_stock_cache", "erp5_pdm")):
if x not in template_list:
try:
template_list.insert(template_list.index(y), x)
except ValueError:
pass
self.setUpERP5Site(business_template_list=template_list, self.setUpERP5Site(business_template_list=template_list,
light_install=light_install, light_install=light_install,
create_activities=create_activities, create_activities=create_activities,
...@@ -1274,9 +1266,8 @@ class ERP5TypeCommandLineTestCase(ERP5TypeTestCaseMixin): ...@@ -1274,9 +1266,8 @@ class ERP5TypeCommandLineTestCase(ERP5TypeTestCaseMixin):
self.dynamicWorkflowConversion() self.dynamicWorkflowConversion()
portal.portal_types.resetDynamicDocumentsOnceAtTransactionBoundary() portal.portal_types.resetDynamicDocumentsOnceAtTransactionBoundary()
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) self.tic(not quiet)
# Log out # Log out
if not quiet: if not quiet:
ZopeTestCase._print('Logout ... \n') ZopeTestCase._print('Logout ... \n')
......
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