Commit 52308764 authored by Jérome Perrin's avatar Jérome Perrin Committed by Arnaud Fontaine

patches: remove addPossibleTransition API on workflow

This was only useful during the transition to ERP5 Workflow, now
that workflows are migrated, Category API (setDestination) is more
natural, so there's no reason to keep this patch
parent cbedc73e
......@@ -2712,10 +2712,12 @@ class TestInventory(TestOrderMixin, ERP5TypeTestCase):
Make sure that changing workflow state after delivered changes
records in stock table.
"""
delivered_state = self.portal.portal_workflow.inventory_workflow.getStateValueByReference('delivered')
delivered_state.addPossibleTransition('cancel')
self.commit()
inventory_workflow = self.portal.portal_workflow.inventory_workflow
delivered_state = inventory_workflow.getStateValueByReference('delivered')
delivered_state.setDestinationValueSet(
delivered_state.getDestinationValueList()
+ [inventory_workflow.getTransitionValueByReference('cancel')]
)
organisation = self.portal.organisation_module.newContent(portal_type='Organisation')
product = self.portal.product_module.newContent(portal_type='Product')
......
......@@ -58,15 +58,6 @@ class WorkflowState(IdAsReferenceMixin("state_"),
'WorkflowState',
)
def addPossibleTransition(self, tr_ref):
possible_transition_list = self.getCategoryList()
transition = self.getParentValue()._getOb('transition_'+tr_ref, None)
if transition is not None:
tr_path = 'destination/' + '/'.join(transition.getPath().split('/')[2:])
possible_transition_list.append(tr_path)
self.setCategoryList(possible_transition_list)
# XXX(PERF): hack to see Category Tool responsability in new workflow slowness
security.declareProtected(Permissions.AccessContentsInformation,
'getDestinationList')
......
......@@ -1041,9 +1041,9 @@ def convertToERP5Workflow(self, temp_object=False):
# set state's possible transitions:
for sid in self.states:
sdef = workflow._getOb('state_'+sid)
new_category = []
for transition_id in self.states.get(sid).transitions:
sdef.addPossibleTransition(transition_id)
sdef.setDestinationValueList([
workflow.getTransitionValueByReference(tid)
for tid in self.states.get(sid).transitions])
# set transition's destination state:
for tid in dc_workflow_transition_value_list:
tdef = workflow.getTransitionValueByReference(tid)
......
......@@ -45,10 +45,6 @@ def setProperties(self, title='', transitions=(), REQUEST=None, description='',
if REQUEST is not None:
return self.manage_properties(REQUEST, 'Properties changed.')
def addPossibleTransition(self, tr_ref):
self.transitions = self.transitions + (tr_ref,)
StateDefinition.addPossibleTransition = addPossibleTransition
StateDefinition._properties_form = _properties_form
StateDefinition.getAvailableTypeList = getAvailableTypeList
StateDefinition.setProperties = setProperties
......
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