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