Commit dbf2a175 authored by Yoshinori Okuji's avatar Yoshinori Okuji

Fix a bug that _process* add movement_group_node into movement_group_node_list...

Fix a bug that _process* add movement_group_node into movement_group_node_list even when they should not. The fix requires that movement_group_node_list be prepared by the caller instead of the callee, because it is not feasible to detect how it is called from the callee perfectly.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@38258 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 160245d5
...@@ -413,8 +413,6 @@ class OrderBuilder(XMLObject, Amount, Predicate): ...@@ -413,8 +413,6 @@ class OrderBuilder(XMLObject, Amount, Predicate):
movement_group_node_list = [] movement_group_node_list = []
if divergence_list is None: if divergence_list is None:
divergence_list = [] divergence_list = []
# do not use 'append' or '+=' because they are destructive.
movement_group_node_list = movement_group_node_list + [movement_group_node]
# Parameter initialization # Parameter initialization
if delivery_to_update_list is None: if delivery_to_update_list is None:
delivery_to_update_list = [] delivery_to_update_list = []
...@@ -423,15 +421,17 @@ class OrderBuilder(XMLObject, Amount, Predicate): ...@@ -423,15 +421,17 @@ class OrderBuilder(XMLObject, Amount, Predicate):
if collect_order_list: if collect_order_list:
# Get sorted movement for each delivery # Get sorted movement for each delivery
for grouped_node in movement_group_node.getGroupList(): for grouped_node in movement_group_node.getGroupList():
# do not use 'append' or '+=' because they are destructive.
new_movement_group_node_list = movement_group_node_list + [grouped_node]
new_delivery_list = self._processDeliveryGroup( new_delivery_list = self._processDeliveryGroup(
delivery_module, delivery_module,
grouped_node, grouped_node,
collect_order_list[1:], collect_order_list[1:],
movement_group_node_list=movement_group_node_list, movement_group_node_list=new_movement_group_node_list,
delivery_to_update_list=delivery_to_update_list, delivery_to_update_list=delivery_to_update_list,
divergence_list=divergence_list, divergence_list=divergence_list,
activate_kw=activate_kw, activate_kw=activate_kw,
force_update=force_update) force_update=force_update)
delivery_list.extend(new_delivery_list) delivery_list.extend(new_delivery_list)
force_update = 0 force_update = 0
else: else:
...@@ -470,6 +470,7 @@ class OrderBuilder(XMLObject, Amount, Predicate): ...@@ -470,6 +470,7 @@ class OrderBuilder(XMLObject, Amount, Predicate):
delivery, delivery,
grouped_node, grouped_node,
self.getDeliveryLineMovementGroupList()[1:], self.getDeliveryLineMovementGroupList()[1:],
movement_group_node_list=[grouped_node],
divergence_list=divergence_list, divergence_list=divergence_list,
delivery_line_to_update_list=delivery_line_to_update_list, delivery_line_to_update_list=delivery_line_to_update_list,
activate_kw=activate_kw, activate_kw=activate_kw,
...@@ -504,17 +505,17 @@ class OrderBuilder(XMLObject, Amount, Predicate): ...@@ -504,17 +505,17 @@ class OrderBuilder(XMLObject, Amount, Predicate):
divergence_list = [] divergence_list = []
if delivery_line_to_update_list is None: if delivery_line_to_update_list is None:
delivery_line_to_update_list = [] delivery_line_to_update_list = []
# do not use 'append' or '+=' because they are destructive.
movement_group_node_list = movement_group_node_list + [movement_group_node]
if collect_order_list and not movement_group_node.getCurrentMovementGroup().isBranch(): if collect_order_list and not movement_group_node.getCurrentMovementGroup().isBranch():
# Get sorted movement for each delivery line # Get sorted movement for each delivery line
for grouped_node in movement_group_node.getGroupList(): for grouped_node in movement_group_node.getGroupList():
# do not use 'append' or '+=' because they are destructive.
new_movement_group_node_list = movement_group_node_list + [grouped_node]
self._processDeliveryLineGroup( self._processDeliveryLineGroup(
delivery, delivery,
grouped_node, grouped_node,
collect_order_list[1:], collect_order_list[1:],
movement_group_node_list=movement_group_node_list, movement_group_node_list=new_movement_group_node_list,
divergence_list=divergence_list, divergence_list=divergence_list,
delivery_line_to_update_list=delivery_line_to_update_list, delivery_line_to_update_list=delivery_line_to_update_list,
activate_kw=activate_kw, activate_kw=activate_kw,
...@@ -550,7 +551,7 @@ class OrderBuilder(XMLObject, Amount, Predicate): ...@@ -550,7 +551,7 @@ class OrderBuilder(XMLObject, Amount, Predicate):
delivery_line, delivery_line,
grouped_node, grouped_node,
collect_order_list[1:], collect_order_list[1:],
movement_group_node_list=movement_group_node_list, movement_group_node_list=[grouped_node],
divergence_list=divergence_list, divergence_list=divergence_list,
delivery_line_to_update_list=nested_delivery_line_to_update_list, delivery_line_to_update_list=nested_delivery_line_to_update_list,
activate_kw=activate_kw, activate_kw=activate_kw,
...@@ -581,6 +582,7 @@ class OrderBuilder(XMLObject, Amount, Predicate): ...@@ -581,6 +582,7 @@ class OrderBuilder(XMLObject, Amount, Predicate):
delivery_line, delivery_line,
grouped_node, grouped_node,
self.getDeliveryCellMovementGroupList()[1:], self.getDeliveryCellMovementGroupList()[1:],
movement_group_node_list=[grouped_node],
update_existing_line=update_existing_line, update_existing_line=update_existing_line,
divergence_list=divergence_list, divergence_list=divergence_list,
delivery_movement_to_update_list=delivery_movement_to_update_list, delivery_movement_to_update_list=delivery_movement_to_update_list,
...@@ -589,11 +591,9 @@ class OrderBuilder(XMLObject, Amount, Predicate): ...@@ -589,11 +591,9 @@ class OrderBuilder(XMLObject, Amount, Predicate):
else: else:
self._processDeliveryCellGroup( self._processDeliveryCellGroup(
delivery_line, delivery_line,
# FIXME passing current movement group node
# has bad side effect, so the logic must
# be corrected.
movement_group_node, movement_group_node,
[], [],
movement_group_node_list=[],
update_existing_line=update_existing_line, update_existing_line=update_existing_line,
divergence_list=divergence_list, divergence_list=divergence_list,
delivery_movement_to_update_list=[delivery_line], delivery_movement_to_update_list=[delivery_line],
...@@ -628,17 +628,16 @@ class OrderBuilder(XMLObject, Amount, Predicate): ...@@ -628,17 +628,16 @@ class OrderBuilder(XMLObject, Amount, Predicate):
delivery_movement_to_update_list = [] delivery_movement_to_update_list = []
if divergence_list is None: if divergence_list is None:
divergence_list = [] divergence_list = []
# do not use 'append' or '+=' because they are destructive.
movement_group_node_list = movement_group_node_list + [movement_group_node]
if collect_order_list: if collect_order_list:
# Get sorted movement for each delivery line # Get sorted movement for each delivery line
for grouped_node in movement_group_node.getGroupList(): for grouped_node in movement_group_node.getGroupList():
new_movement_group_node_list = movement_group_node_list + [grouped_node]
self._processDeliveryCellGroup( self._processDeliveryCellGroup(
delivery_line, delivery_line,
grouped_node, grouped_node,
collect_order_list[1:], collect_order_list[1:],
movement_group_node_list=movement_group_node_list, movement_group_node_list=new_movement_group_node_list,
update_existing_line=update_existing_line, update_existing_line=update_existing_line,
divergence_list=divergence_list, divergence_list=divergence_list,
delivery_movement_to_update_list=delivery_movement_to_update_list, delivery_movement_to_update_list=delivery_movement_to_update_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