Commit 621f33c9 authored by Yoshinori Okuji's avatar Yoshinori Okuji

No need to record updated deliveries by using a destructive manipulation on...

No need to record updated deliveries by using a destructive manipulation on the list of deliveries to be updated.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@38188 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 14f46326
...@@ -407,9 +407,6 @@ class OrderBuilder(XMLObject, Amount, Predicate): ...@@ -407,9 +407,6 @@ class OrderBuilder(XMLObject, Amount, Predicate):
else: else:
# Test if we can update a existing delivery, or if we need to create # Test if we can update a existing delivery, or if we need to create
# a new one # a new one
delivery_to_update_list = [
x for x in delivery_to_update_list \
if not self._isUpdated(x, 'delivery')]
delivery, property_dict = self._findUpdatableObject( delivery, property_dict = self._findUpdatableObject(
delivery_to_update_list, movement_group_node_list, delivery_to_update_list, movement_group_node_list,
divergence_list) divergence_list)
...@@ -423,8 +420,12 @@ class OrderBuilder(XMLObject, Amount, Predicate): ...@@ -423,8 +420,12 @@ class OrderBuilder(XMLObject, Amount, Predicate):
delivery = self._createDelivery(delivery_module, delivery = self._createDelivery(delivery_module,
movement_group_node.getMovementList(), movement_group_node.getMovementList(),
activate_kw) activate_kw)
else:
# The same delivery should not be updated more than once.
# Note that it is important to use a destructive method here.
delivery_to_update_list.remove(delivery)
# Put properties on delivery # Put properties on delivery
self._setUpdated(delivery, 'delivery')
if property_dict: if property_dict:
property_dict.setdefault('edit_order', ('stop_date', 'start_date')) property_dict.setdefault('edit_order', ('stop_date', 'start_date'))
delivery.edit(**property_dict) delivery.edit(**property_dict)
......
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