[Erp5-report] r28016 - in /erp5/trunk/products/ERP5/Document: BPMInvoicingRule.py BPMRule.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Wed Jul 8 11:54:37 CEST 2009
Author: luke
Date: Wed Jul 8 11:54:37 2009
New Revision: 28016
URL: http://svn.erp5.org?rev=28016&view=rev
Log:
- move candidate of generic code to base class
- alter only needed property on generated list
Modified:
erp5/trunk/products/ERP5/Document/BPMInvoicingRule.py
erp5/trunk/products/ERP5/Document/BPMRule.py
Modified: erp5/trunk/products/ERP5/Document/BPMInvoicingRule.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/BPMInvoicingRule.py?rev=28016&r1=28015&r2=28016&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/BPMInvoicingRule.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/BPMInvoicingRule.py [utf8] Wed Jul 8 11:54:37 2009
@@ -72,32 +72,14 @@
"""
return 0
-#### Helper method for expand
+#### Helper methods for expand
def _generatePrevisionList(self, applied_rule, **kw):
- """
- Generate a list of movements, that should be children of this rule,
- based on its context (parent movement, delivery, configuration ...)
-
- These previsions are returned as dictionaries.
- """
- # XXX Isn't it better to share the code with expand method
- context_movement = applied_rule.getParentValue()
- business_process = applied_rule.getBusinessProcessValue()
-
- movement_and_path_list = []
- for business_path in business_process.getPathValueList(
- self.getProperty('trade_phase_list'),
- context_movement):
- movement_and_path_list.append((context_movement, business_path))
-
- if len(movement_and_path_list) > 1:
- raise NotImplementedError
-
- for movement, business_path in movement_and_path_list:
- property_dict = self._getExpandablePropertyDict(
- applied_rule, movement, business_path)
- property_dict['deliverable'] = 1
- return [property_dict]
+ return_list = []
+ for prevision_dict in BPMRule._generatePrevisionList(self, applied_rule,
+ **kw):
+ prevision_dict['deliverable'] = 1
+ return_list.append(prevision_dict)
+ return return_list
security.declareProtected(Permissions.ModifyPortalContent, 'expand')
def expand(self, applied_rule, force=0, **kw):
Modified: erp5/trunk/products/ERP5/Document/BPMRule.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/BPMRule.py?rev=28016&r1=28015&r2=28016&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/BPMRule.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/BPMRule.py [utf8] Wed Jul 8 11:54:37 2009
@@ -242,3 +242,29 @@
property_dict['causality_value'] = business_path
return property_dict
+
+ def _generatePrevisionList(self, applied_rule, **kw):
+ """
+ Generate a list of movements, that should be children of this rule,
+ based on its context (parent movement, delivery, configuration ...)
+
+ These previsions are returned as dictionaries.
+ """
+ # XXX support list of movements
+ context_movement = applied_rule.getParentValue()
+ business_process = applied_rule.getBusinessProcessValue()
+
+ movement_and_path_list = []
+ for business_path in business_process.getPathValueList(
+ self.getProperty('trade_phase_list'),
+ context_movement):
+ movement_and_path_list.append((context_movement, business_path))
+
+ if len(movement_and_path_list) > 1:
+ raise NotImplementedError
+
+ for movement, business_path in movement_and_path_list:
+ property_dict = self._getExpandablePropertyDict(
+ applied_rule, movement, business_path)
+ property_dict['deliverable'] = 1
+ return [property_dict]
More information about the Erp5-report
mailing list