Commit e0e87b59 authored by Jérome Perrin's avatar Jérome Perrin

get objects from the portal to cut acquisition chain

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6973 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a36bb967
...@@ -125,7 +125,7 @@ class DeliveryBuilder(OrderBuilder): ...@@ -125,7 +125,7 @@ class DeliveryBuilder(OrderBuilder):
kw.update(self.portal_catalog.buildSQLQuery(**kw)) kw.update(self.portal_catalog.buildSQLQuery(**kw))
movement_list = [x.getObject() for x in self.portal_catalog(**kw)] movement_list = [x.getObject() for x in self.portal_catalog(**kw)]
else: else:
select_method = getattr(self, self.simulation_select_method_id) select_method = getattr(self.getPortalObject(), self.simulation_select_method_id)
movement_list = select_method(**kw) movement_list = select_method(**kw)
# XXX Use buildSQLQuery will be better # XXX Use buildSQLQuery will be better
movement_list = filter(lambda x: x.getDeliveryRelatedValueList()==[], movement_list = filter(lambda x: x.getDeliveryRelatedValueList()==[],
...@@ -177,7 +177,7 @@ class DeliveryBuilder(OrderBuilder): ...@@ -177,7 +177,7 @@ class DeliveryBuilder(OrderBuilder):
simulation related to this transaction. simulation related to this transaction.
""" """
# We have to get a delivery, else, raise a Error # We have to get a delivery, else, raise a Error
delivery = self.restrictedTraverse(delivery_relative_url) delivery = self.getPortalObject().restrictedTraverse(delivery_relative_url)
delivery_uid = delivery.getUid() delivery_uid = delivery.getUid()
......
...@@ -140,7 +140,7 @@ class OrderBuilder(XMLObject, Amount, Predicate): ...@@ -140,7 +140,7 @@ class OrderBuilder(XMLObject, Amount, Predicate):
delivery_module_before_building_script_id = \ delivery_module_before_building_script_id = \
self.getDeliveryModuleBeforeBuildingScriptId() self.getDeliveryModuleBeforeBuildingScriptId()
if delivery_module_before_building_script_id not in ["", None]: if delivery_module_before_building_script_id not in ["", None]:
delivery_module = getattr(self, self.getDeliveryModule()) delivery_module = getattr(self.getPortalObject(), self.getDeliveryModule())
getattr(delivery_module, delivery_module_before_building_script_id)() getattr(delivery_module, delivery_module_before_building_script_id)()
def searchMovementList(self, applied_rule_uid=None,**kw): def searchMovementList(self, applied_rule_uid=None,**kw):
...@@ -271,13 +271,14 @@ class OrderBuilder(XMLObject, Amount, Predicate): ...@@ -271,13 +271,14 @@ class OrderBuilder(XMLObject, Amount, Predicate):
if delivery_relative_url_list is None: if delivery_relative_url_list is None:
delivery_relative_url_list = [] delivery_relative_url_list = []
# Module where we can create new deliveries # Module where we can create new deliveries
delivery_module = getattr(self, self.getDeliveryModule()) portal = self.getPortalObject()
delivery_to_update_list = [self.restrictedTraverse(relative_url) for \ delivery_module = getattr(portal, self.getDeliveryModule())
delivery_to_update_list = [portal.restrictedTraverse(relative_url) for \
relative_url in delivery_relative_url_list] relative_url in delivery_relative_url_list]
# Deliveries we are trying to update # Deliveries we are trying to update
delivery_select_method_id = self.getDeliverySelectMethodId() delivery_select_method_id = self.getDeliverySelectMethodId()
if delivery_select_method_id not in ["", None]: if delivery_select_method_id not in ["", None]:
to_update_delivery_sql_list = getattr(self, delivery_select_method_id) \ to_update_delivery_sql_list = getattr(portal, 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 \
......
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