[Erp5-report] r26576 - /erp5/trunk/products/ERP5/Document/AppliedRule.py

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Apr 22 10:27:27 CEST 2009


Author: jerome
Date: Wed Apr 22 10:27:25 2009
New Revision: 26576

URL: http://svn.erp5.org?rev=26576&view=rev
Log:
add a method to find corresponding business process model

Modified:
    erp5/trunk/products/ERP5/Document/AppliedRule.py

Modified: erp5/trunk/products/ERP5/Document/AppliedRule.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/AppliedRule.py?rev=26576&r1=26575&r2=26576&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/AppliedRule.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/AppliedRule.py [utf8] Wed Apr 22 10:27:25 2009
@@ -206,6 +206,29 @@
         return self
       return self.getParentValue().getRootAppliedRule()
 
+    security.declareProtected(Permissions.AccessContentsInformation,
+                             'getBusinessProcessModelValue')
+    def getBusinessProcessModelValue(self):
+      """Return the business process model that has been used in this
+      simulation, or None if no business process has been used.
+      """
+      root = self.getRootAppliedRule()
+      causality = root.getCausalityValue()
+
+      def findBusinessProcessModel(context):
+        if context.getPortalType() == 'Business Process':
+          return context
+        for specialise in context.getSpecialiseValueList():
+          business_process = findBusinessProcessModel(specialise)
+          if business_process is not None:
+            return business_process
+        
+      if causality is not None and getattr(causality, 'getSpecialiseValueList',
+                                            None) is not None:
+        return findBusinessProcessModel(causality)
+
+      return None
+
     security.declareProtected(Permissions.ModifyPortalContent,
                               'notifySimulationChange')
     def notifySimulationChange(self, notify_dict):




More information about the Erp5-report mailing list