[Erp5-report] r36585 nicolas.dumazet - /erp5/trunk/products/ERP5/Document/
nobody at svn.erp5.org
nobody at svn.erp5.org
Fri Jun 25 12:23:58 CEST 2010
Author: nicolas.dumazet
Date: Fri Jun 25 12:23:52 2010
New Revision: 36585
URL: http://svn.erp5.org?rev=36585&view=rev
Log:
use closure to simplify calculation of isBuildable:
since the closure will stay the same among all business paths,
transform
for path in previous_path_list:
for movement in path.getRelatedMovementValueList():
into:
closure = current_path.getBusinessPathClosure()
for movement in closure:
This means that number of simulation tree walks is reduced by a factor of
len(previous_path_list)
Modified:
erp5/trunk/products/ERP5/Document/SimulationMovement.py
Modified: erp5/trunk/products/ERP5/Document/SimulationMovement.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/SimulationMovement.py?rev=36585&r1=36584&r2=36585&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/SimulationMovement.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/SimulationMovement.py [utf8] Fri Jun 25 12:23:52 2010
@@ -567,10 +567,26 @@ class SimulationMovement(Movement, Prope
# first one, can be built
return True
- for successor_related in predecessor.getSuccessorRelatedValueList():
- for business_path_movement in successor_related \
- .getRelatedSimulationMovementValueList(explanation_value):
- if successor_related.isMovementRelatedWithMovement(self,
+ portal_catalog = self.getPortalObject().portal_catalog
+
+ delivery_simulation_movement_list = portal_catalog(
+ delivery_uid=[x.getUid() for x in explanation_value.getMovementList()])
+
+ simulation_movement_list = business_path.getBusinessPathClosure(
+ delivery_simulation_movement_list)
+
+ # store a causality -> causality_related_movement_list mapping
+ causality_dict = dict()
+ for mov in simulation_movement_list:
+ causality_dict.setdefault(mov.getCausality(), []).append(mov)
+
+
+ for parent_path in predecessor.getSuccessorRelatedValueList():
+ causality = parent_path.getRelativeUrl()
+ related_simulation_list = causality_dict.get(causality, [])
+
+ for business_path_movement in related_simulation_list:
+ if parent_path.isMovementRelatedWithMovement(self,
business_path_movement):
business_path_movement_delivery = business_path_movement \
.getDeliveryValue()
@@ -581,7 +597,7 @@ class SimulationMovement(Movement, Prope
business_path_movement_delivery.getExplanationValue()
# here we can optimise somehow, as
# business_path_movement_delivery_document would repeat
- if not successor_related.isCompleted(
+ if not parent_path.isCompleted(
business_path_movement_delivery_document):
# related movements delivery is not completed
return False
More information about the Erp5-report
mailing list