Commit 0c5fe26d authored by Julien Muchembled's avatar Julien Muchembled

Small optimization of SimulationMovement.getExplanationValue

parent 0be3a11a
...@@ -373,8 +373,8 @@ class SimulationMovement(PropertyRecordableMixin, Movement, ExplainableMixin): ...@@ -373,8 +373,8 @@ class SimulationMovement(PropertyRecordableMixin, Movement, ExplainableMixin):
"""Returns the delivery if any or the order related to the root """Returns the delivery if any or the order related to the root
applied rule if any. applied rule if any.
""" """
delivery_value = self.getDeliveryValue() explanation_value = self.getDeliveryValue()
if delivery_value is None: if explanation_value is None:
# If the parent is not an Applied Rule, self does not have the method. # If the parent is not an Applied Rule, self does not have the method.
getRootAppliedRule = getattr(self, 'getRootAppliedRule', None) getRootAppliedRule = getattr(self, 'getRootAppliedRule', None)
if getRootAppliedRule is None: if getRootAppliedRule is None:
...@@ -386,15 +386,13 @@ class SimulationMovement(PropertyRecordableMixin, Movement, ExplainableMixin): ...@@ -386,15 +386,13 @@ class SimulationMovement(PropertyRecordableMixin, Movement, ExplainableMixin):
else: else:
# Ex. zero stock rule # Ex. zero stock rule
return ra return ra
else:
explanation_value = delivery_value
portal = self.getPortalObject() portal = self.getPortalObject()
delivery_type_list = self.getPortalDeliveryTypeList() \ delivery_type_list = portal.getPortalDeliveryTypeList() \
+ self.getPortalOrderTypeList() + portal.getPortalOrderTypeList()
while explanation_value.getPortalType() not in delivery_type_list and \ while explanation_value.getPortalType() not in delivery_type_list:
explanation_value != portal:
explanation_value = explanation_value.getParentValue() explanation_value = explanation_value.getParentValue()
if explanation_value != portal: if explanation_value == portal:
return
return explanation_value return explanation_value
# Deliverability / orderability # 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