Commit 217a9d73 authored by Julien Muchembled's avatar Julien Muchembled

Do not compensate SM with quantity=0 and set quantity=0 on built but not-frozen SM to delete

parent 0ebd4581
......@@ -365,12 +365,17 @@ class RuleMixin(Predicate):
if decision_movement.isDeletable():
# Delete deletable
movement_collection_diff.addDeletableMovement(decision_movement)
else:
# Compensate non deletable
new_movement = decision_movement.asContext(
quantity=-decision_movement.getQuantity())
continue
quantity = decision_movement.getQuantity()
if quantity:
if decision_movement.isFrozen():
# Compensate
new_movement = decision_movement.asContext(quantity=-quantity)
new_movement.setDelivery(None)
movement_collection_diff.addNewMovement(new_movement)
else:
movement_collection_diff.addUpdatableMovement(decision_movement,
{'quantity': 0})
return
# Case 2: movements which should be added
......
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