Commit 29837359 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

improve _extendMovementCollectionDiff implementation.

* if decition_movement_list is empty, we just add prevision_movement as 'NewMovement'.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@31065 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 28a7ff44
......@@ -284,7 +284,6 @@ class RuleMixin:
are part of the matching group and updates movement_collection_diff
accordingly
"""
raise NotImplementedError
# Sample implementation - but it actually looks very generic
# Case 1: movements which are not needed
if prevision_movement is None:
......@@ -299,7 +298,12 @@ class RuleMixin:
new_movement = decision_movement.asContext(quantity=-decision_movement.getQuantity())
movement_collection_diff.addNewMovement(new_movement)
return
# Case 2: movements which are needed but may need update or compensation_movement_list
# Case 2: movements which should be added
elif len(decision_movement_list) == 0:
# if decision_movement_list is empty, we can just create a new one.
movement_collection_diff.addNewMovement(prevision_movement)
return
# Case 3: movements which are needed but may need update or compensation_movement_list
# let us imagine the case of a forward rule
# ie. what comes in must either go out or has been lost
divergence_tester_list = self._getDivergenceTesterList()
......
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