Commit dc984ae3 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

we need to calculate first causality in test() too, but the expected behaviour...

we need to calculate first causality in test() too, but the expected behaviour of this movement group in delivery level is unclear.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@35180 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 3c5987f9
...@@ -40,18 +40,31 @@ class FirstCausalityMovementGroup(CausalityMovementGroup): ...@@ -40,18 +40,31 @@ class FirstCausalityMovementGroup(CausalityMovementGroup):
def test(self, movement, property_dict, **kw): def test(self, movement, property_dict, **kw):
"""Compare explanation to now if it is possible to update delivery""" """Compare explanation to now if it is possible to update delivery"""
explanation = property_dict.get('_explanation','') explanation = property_dict.get('_explanation','')
if movement.getRelativeUrl() == explanation: if movement == movement.getDeliveryValue():
return True, {} # XXX what is the expected behaviour of this movement group in
# delivery level?
if movement.getRelativeUrl() == explanation:
return True, {}
else:
return False, {}
else: else:
return False, {} simulation_movement = movement.getDeliveryRelatedValue()
if simulation_movement is not None and \
self._getExplanationRelativeUrl(simulation_movement) == explanation:
return True, {}
else:
return False, {}
def _getExplanationRelativeUrl(self, movement): def _getExplanationRelativeUrl(self, movement):
""" Get the order value for a movement """ """ Get the order value for a movement """
parent = movement.getParentValue().getParentValue() applied_rule = movement.getParentValue()
parent = applied_rule.getParentValue()
# Go upper into the simulation tree in order to find a delivery link # Go upper into the simulation tree in order to find a delivery link
while parent.getDeliveryValue() is None and not(parent.isRootAppliedRule()): parent_delivery = parent.getDeliveryValue()
while parent_delivery is None and not parent.isRootAppliedRule():
parent = parent.getParentValue() parent = parent.getParentValue()
delivery_movement = parent.getDeliveryValue() parent_delivery = parent.getDeliveryValue()
delivery_movement = parent_delivery
delivery_url = None delivery_url = None
if delivery_movement is not None: if delivery_movement is not None:
delivery = delivery_movement.getExplanationValue() delivery = delivery_movement.getExplanationValue()
......
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