Commit 6ba4b8e1 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

do not try to update existing deliveries if build() is called with update=False explicitly.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@34774 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a5ee246e
...@@ -314,7 +314,7 @@ class OrderBuilder(XMLObject, Amount, Predicate): ...@@ -314,7 +314,7 @@ class OrderBuilder(XMLObject, Amount, Predicate):
@UnrestrictedMethod @UnrestrictedMethod
def buildDeliveryList(self, movement_group_node, def buildDeliveryList(self, movement_group_node,
delivery_relative_url_list=None, delivery_relative_url_list=None,
movement_list=None, **kw): movement_list=None, update=True, **kw):
""" """
Build deliveries from a list of movements Build deliveries from a list of movements
""" """
...@@ -326,16 +326,19 @@ class OrderBuilder(XMLObject, Amount, Predicate): ...@@ -326,16 +326,19 @@ class OrderBuilder(XMLObject, Amount, Predicate):
# Module where we can create new deliveries # Module where we can create new deliveries
portal = self.getPortalObject() portal = self.getPortalObject()
delivery_module = getattr(portal, self.getDeliveryModule()) delivery_module = getattr(portal, self.getDeliveryModule())
delivery_to_update_list = [portal.restrictedTraverse(relative_url) for \ if update:
relative_url in delivery_relative_url_list] delivery_to_update_list = [portal.restrictedTraverse(relative_url) for \
# Deliveries we are trying to update relative_url in delivery_relative_url_list]
delivery_select_method_id = self.getDeliverySelectMethodId() # Deliveries we are trying to update
if delivery_select_method_id not in ["", None]: delivery_select_method_id = self.getDeliverySelectMethodId()
to_update_delivery_sql_list = getattr(self, delivery_select_method_id) \ if delivery_select_method_id not in ["", None]:
to_update_delivery_sql_list = getattr(self, delivery_select_method_id) \
(movement_list=movement_list) (movement_list=movement_list)
delivery_to_update_list.extend([sql_delivery.getObject() \ delivery_to_update_list.extend([sql_delivery.getObject() \
for sql_delivery \ for sql_delivery \
in to_update_delivery_sql_list]) in to_update_delivery_sql_list])
else:
delivery_to_update_list = []
# We do not want to update the same object more than twice in one # We do not want to update the same object more than twice in one
# _deliveryGroupProcessing(). # _deliveryGroupProcessing().
self._resetUpdated() self._resetUpdated()
......
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