Commit 8a10405a authored by Yoshinori Okuji's avatar Yoshinori Okuji

Stop calling the same methods many times.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@33978 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent ba3e06d9
......@@ -287,7 +287,8 @@ class SimulationMovement(Movement, PropertyRecordableMixin):
"""Returns the delivery if any or the order related to the root
applied rule if any.
"""
if self.getDeliveryValue() is None:
delivery_value = self.getDeliveryValue()
if delivery_value is None:
ra = self.getRootAppliedRule()
order = ra.getCausalityValue()
if order is not None:
......@@ -296,12 +297,13 @@ class SimulationMovement(Movement, PropertyRecordableMixin):
# Ex. zero stock rule
return ra
else:
explanation_value = self.getDeliveryValue()
while explanation_value.getPortalType() not in \
self.getPortalDeliveryTypeList() and \
explanation_value != self.getPortalObject():
explanation_value = delivery_value
portal = self.getPortalObject()
delivery_type_list = self.getPortalDeliveryTypeList()
while explanation_value.getPortalType() not in delivery_type_list and \
explanation_value != portal:
explanation_value = explanation_value.getParentValue()
if explanation_value != self.getPortalObject():
if explanation_value != portal:
return explanation_value
# Deliverability / orderability
......
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