Commit 3fc96e1a authored by Ayush Tiwari's avatar Ayush Tiwari Committed by Ayush Tiwari

bt5_config: Override accessors for type_workflow_list accroding to need for...

bt5_config: Override accessors for type_workflow_list accroding to need for portal_workflow chain bootstrap
parent 4a7ef98b
......@@ -344,9 +344,16 @@ class ERP5TypeInformation(XMLObject,
if cbt is not None and cbt.has_key(id):
workflow_list = list(cbt[id])
else:
workflow_list = ['(Default)',]
workflow_list = None
return workflow_list
def hasTypeWorkflowList(self):
"""
Always return True. Overriden as general accessor is generated after the
use of this function while installing Business Manager
"""
return True
security.declareProtected(Permissions.ModifyPortalContent,
'setTypeWorkflowList')
def _setTypeWorkflowList(self, type_workflow_list):
......@@ -355,25 +362,32 @@ class ERP5TypeInformation(XMLObject,
# installation of Business Manager. This way, we would be able to
# modify workflow chain without the need of saving anything in
# type_workflow_list property.
portal = self.getPortalObject()
pw = portal.portal_workflow
cbt = pw._chains_by_type
id = self.getId()
# If the type_workflow_list is empty, delete the key from workflow chains
if not type_workflow_list:
cbt[id] = []
pw._chains_by_type = cbt
# If type_workflow_list is '(Default)', don't do/update anything
if type_workflow_list[0] != '(Default)':
portal = self.getPortalObject()
pw = portal.portal_workflow
cbt = pw._chains_by_type
id = self.getId()
elif type_workflow_list[0] != '(Default)':
# If there is already key existing in cbt, then update it
if cbt is not None and cbt.has_key(id):
workflow_list = list(cbt(id))
workflow_list = list(cbt[id])
if not workflow_list:
cbt[id] = sorted(type_workflow_list)
# If the value in cbt is '(Default)', then update it only after removing
# default value
if workflow_list[0] != '(Default)':
elif workflow_list[0] != '(Default)':
type_workflow_list = type_workflow_list.extend(workflow_list)
cbt[id] = type_workflow_list
cbt[id] = sorted(type_workflow_list)
cbt[id] = sorted(type_workflow_list)
# Update the chains dictionary for portal_workflow
pw._chains_by_type = cbt
......
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