[Erp5-report] r27693 - /erp5/trunk/products/ERP5Type/patches/WorkflowTool.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Fri Jun 19 18:38:25 CEST 2009
Author: jm
Date: Fri Jun 19 18:38:22 2009
New Revision: 27693
URL: http://svn.erp5.org?rev=27693&view=rev
Log:
Add a method to workflow tool to know if a given transition exists from the current state.
Modified:
erp5/trunk/products/ERP5Type/patches/WorkflowTool.py
Modified: erp5/trunk/products/ERP5Type/patches/WorkflowTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/patches/WorkflowTool.py?rev=27693&r1=27692&r2=27693&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/patches/WorkflowTool.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/patches/WorkflowTool.py [utf8] Fri Jun 19 18:38:22 2009
@@ -771,3 +771,14 @@
WorkflowTool.getFutureStateSetFor = lambda self, wf_id, *args, **kw: \
self[wf_id].getFutureStateSet(*args, **kw)
+
+def WorkflowTool_isTransitionPossible(self, ob, transition_id, wf_id=None):
+ """Test if the given transition exist from the current state.
+ """
+ for workflow in (wf_id and (self[wf_id],) or self.getWorkflowsFor(ob)):
+ state = workflow._getWorkflowStateOf(ob)
+ if state and transition_id in state.transitions:
+ return 1
+ return 0
+
+WorkflowTool.isTransitionPossible = WorkflowTool_isTransitionPossible
More information about the Erp5-report
mailing list