Commit 89fd5063 authored by Yoshinori Okuji's avatar Yoshinori Okuji

Optimization.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3231 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent ea072660
...@@ -83,26 +83,29 @@ class OrderRule(Rule): ...@@ -83,26 +83,29 @@ class OrderRule(Rule):
if my_order is not None: if my_order is not None:
# Only expand order rule if order not yet confirmed (This is consistent # Only expand order rule if order not yet confirmed (This is consistent
# with the fact that once simulation is launched, we stick to it) # with the fact that once simulation is launched, we stick to it)
state = applied_rule.getLastExpandSimulationState()
if force or \ if force or \
(applied_rule.getLastExpandSimulationState() not in \ (state not in \
applied_rule.getPortalReservedInventoryStateList() and \ applied_rule.getPortalReservedInventoryStateList() and \
applied_rule.getLastExpandSimulationState() not in \ state not in \
applied_rule.getPortalCurrentInventoryStateList()): applied_rule.getPortalCurrentInventoryStateList()):
# First, check each contained movement and make # First, check each contained movement and make
# a list of order ids which do not need to be copied # a list of order ids which do not need to be copied
# eventually delete movement which do not exist anylonger # eventually delete movement which do not exist anylonger
existing_uid_list = [] existing_uid_list = []
append = existing_uid_list.append
movement_type_list = applied_rule.getPortalMovementTypeList()
for movement in applied_rule.contentValues(filter={'portal_type': \ for movement in applied_rule.contentValues(filter={'portal_type': \
applied_rule.getPortalMovementTypeList()}): movement_type_list}):
order_value = movement.getOrderValue(\ order_value = movement.getOrderValue(\
portal_type=applied_rule.getPortalOrderMovementTypeList()) portal_type=movement_type_list)
if order_value is None: if order_value is None:
movement.flushActivity(invoke=0) movement.flushActivity(invoke=0)
applied_rule._delObject(movement.getId()) applied_rule._delObject(movement.getId())
# XXX Make sur this is not deleted if already in delivery # XXX Make sur this is not deleted if already in delivery
else: else:
if getattr(order_value, 'isCell', 0): if getattr(order_value, 'isCell', 0):
existing_uid_list += [order_value.getUid()] append(order_value.getUid())
elif order_value.hasCellContent(): elif order_value.hasCellContent():
# Do not keep head of cells # Do not keep head of cells
LOG('INFO', 0, 'Order Rule Deleting Simulatino Movement %s' \ LOG('INFO', 0, 'Order Rule Deleting Simulatino Movement %s' \
...@@ -111,11 +114,11 @@ class OrderRule(Rule): ...@@ -111,11 +114,11 @@ class OrderRule(Rule):
applied_rule._delObject(movement.getId()) applied_rule._delObject(movement.getId())
# XXX Make sur this is not deleted if already in delivery # XXX Make sur this is not deleted if already in delivery
else: else:
existing_uid_list += [order_value.getUid()] append(order_value.getUid())
# Copy each movement (line or cell) from the order # Copy each movement (line or cell) from the order
for order_line_object in my_order.contentValues(filter={ \ for order_line_object in my_order.contentValues(filter={ \
'portal_type':applied_rule.getPortalMovementTypeList()}): 'portal_type':movement_type_list}):
LOG('OrderRule.expand, examining:',0, \ LOG('OrderRule.expand, examining:',0, \
order_line_object.getPhysicalPath()) order_line_object.getPhysicalPath())
try: try:
......
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