Commit 63e1a0b3 authored by wenjie.zheng's avatar wenjie.zheng Committed by Sebastien Robin

ERP5Site.py: remove the condition which check the type of workflow type.

parent 6a25a9d5
...@@ -760,15 +760,16 @@ class ERP5Site(FolderMixIn, CMFSite, CacheCookieMixin): ...@@ -760,15 +760,16 @@ class ERP5Site(FolderMixIn, CMFSite, CacheCookieMixin):
def getStateList(group): def getStateList(group):
state_dict = {} state_dict = {}
for wf in self.portal_workflow.objectValues(): for wf in self.portal_workflow.objectValues():
if wf.__class__.__name__ == 'Workflow':
for state in wf.objectValues(portal_type='State'):
if group in getattr(state, 'type_list', ()):
state_dict['_'.join(state.getId().split('_')[1:])] = None
else:
if getattr(wf, 'states', None): if getattr(wf, 'states', None):
# DC Workflow
for state in wf.states.objectValues(): for state in wf.states.objectValues():
if group in getattr(state, 'type_list', ()): if group in getattr(state, 'type_list', ()):
state_dict[state.getId()] = None state_dict[state.getId()] = None
else:
# ERP5 Workflow
for state in wf.objectValues(portal_type='State'):
if group in getattr(state, 'type_list', ()):
state_dict[state.getReference()] = None
return tuple(state_dict.keys()) return tuple(state_dict.keys())
getStateList = CachingMethod(getStateList, getStateList = CachingMethod(getStateList,
...@@ -1288,20 +1289,20 @@ class ERP5Site(FolderMixIn, CMFSite, CacheCookieMixin): ...@@ -1288,20 +1289,20 @@ class ERP5Site(FolderMixIn, CMFSite, CacheCookieMixin):
def getStateList(): def getStateList():
state_dict = {} state_dict = {}
for wf in self.portal_workflow.objectValues(): for wf in self.portal_workflow.objectValues():
if wf.__class__.__name__ == 'Workflow':
if wf.objectValues(portal_type='Variable') and \
wf.getStateVariable() == 'simulation_state':
if wf.objectValues(portal_type='State'):
for state in wf.objectValues(portal_type='State'):
if getattr(state, 'type_list', None):
state_dict['_'.join(state.getId().split('_')[1:])] = None
else:
if getattr(wf, 'variables', None) and \ if getattr(wf, 'variables', None) and \
wf.variables.getStateVar() == 'simulation_state': wf.variables.getStateVar() == 'simulation_state':
# DC Workflow
if getattr(wf, 'states', None): if getattr(wf, 'states', None):
for state in wf.states.objectValues(): for state in wf.states.objectValues():
if getattr(state, 'type_list', None): if getattr(state, 'type_list', None):
state_dict[state.getId()] = None state_dict[state.getId()] = None
elif wf.objectValues(portal_type='Variable') and \
wf.getStateVariable() == 'simulation_state':
# ERP5 Workflow
if wf.objectValues(portal_type='State'):
for state in wf.objectValues(portal_type='State'):
if getattr(state, 'type_list', None):
state_dict[state.getReference()] = None
return tuple(sorted(state_dict.keys())) return tuple(sorted(state_dict.keys()))
getStateList = CachingMethod(getStateList, getStateList = CachingMethod(getStateList,
...@@ -1719,7 +1720,6 @@ class PortalGenerator: ...@@ -1719,7 +1720,6 @@ class PortalGenerator:
addCMFCoreTool('CMF Skins Tool', None) addCMFCoreTool('CMF Skins Tool', None)
addCMFCoreTool('CMF Undo Tool', None) addCMFCoreTool('CMF Undo Tool', None)
addCMFCoreTool('CMF URL Tool', None) addCMFCoreTool('CMF URL Tool', None)
#addCMFCoreTool('CMF Workflow Tool', None) # taken place by ERP5 Workflow Tool
addCMFDefaultTool = p.manage_addProduct['CMFDefault'].manage_addTool addCMFDefaultTool = p.manage_addProduct['CMFDefault'].manage_addTool
addCMFDefaultTool('Default Discussion Tool', None) addCMFDefaultTool('Default Discussion Tool', None)
......
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