Commit 421ab3b1 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

cleanup getRelatedSimulationMovementValueList() by reducing iterations.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@34645 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent e767b447
...@@ -374,22 +374,22 @@ class BusinessPath(Path, Predicate): ...@@ -374,22 +374,22 @@ class BusinessPath(Path, Predicate):
As business sequence is not related to simulation tree need to built As business sequence is not related to simulation tree need to built
full simulation trees per applied rule full simulation trees per applied rule
""" """
portal_catalog = self.getPortalObject().portal_catalog
root_applied_rule_list = [] root_applied_rule_list = []
delivery_simulation_movement_list = [] delivery_simulation_movement_list = portal_catalog(
for movement in explanation.getMovementList(): delivery_uid=[x.getUid() for x in explanation.getMovementList()])
simulation_movement_list = movement.getDeliveryRelatedValueList( # 'order' category is deprecated. it is kept for compatibility.
portal_type='Simulation Movement') if len(delivery_simulation_movement_list) == 0:
if len(simulation_movement_list) == 0: # for legacy simulation hierarchy delivery_simulation_movement_list = portal_catalog(
simulation_movement_list = movement.getOrderRelatedValueList( order_uid=[x.getUid() for x in explanation.getMovementList()])
portal_type='Simulation Movement')
delivery_simulation_movement_list.extend(simulation_movement_list) for simulation_movement in delivery_simulation_movement_list:
for simulation_movement in simulation_movement_list:
applied_rule = simulation_movement.getRootAppliedRule() applied_rule = simulation_movement.getRootAppliedRule()
if applied_rule not in root_applied_rule_list: if applied_rule not in root_applied_rule_list:
root_applied_rule_list.append( root_applied_rule_list.append(
simulation_movement.getRootAppliedRule()) simulation_movement.getRootAppliedRule())
simulation_movement_list = self.getPortalObject().portal_catalog( simulation_movement_list = portal_catalog(
portal_type='Simulation Movement', causality_uid=self.getUid(), portal_type='Simulation Movement', causality_uid=self.getUid(),
path=['%s/%%' % x for x in root_applied_rule_list]) path=['%s/%%' % x for x in root_applied_rule_list])
......
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