Commit 35e49a3a authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

a little bit code optimisation.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@30817 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 4332fde8
...@@ -312,7 +312,8 @@ class RuleMixin: ...@@ -312,7 +312,8 @@ class RuleMixin:
# First, we update all properties (exc. quantity) which could be divergent # First, we update all properties (exc. quantity) which could be divergent
# and if we can not, we compensate them # and if we can not, we compensate them
for decision_movement in decision_movement_list: for decision_movement in decision_movement_list:
decision_quantity += decision_movement.getQuantity() decision_movement_quantity = decision_movement.getQuantity()
decision_quantity += decision_movement_quantity
if self._isProfitAndLossMovement(decision_movement): if self._isProfitAndLossMovement(decision_movement):
if decision_movement.isFrozen(): if decision_movement.isFrozen():
# Record not completed movements # Record not completed movements
...@@ -320,9 +321,9 @@ class RuleMixin: ...@@ -320,9 +321,9 @@ class RuleMixin:
not_completed_movement = decision_movement not_completed_movement = decision_movement
# Frozen must be compensated # Frozen must be compensated
if not _compare(profit_tester_list, prevision_movement, decision_movement): if not _compare(profit_tester_list, prevision_movement, decision_movement):
new_movement = decision_movement.asContext(quantity=-decision_movement.getQuantity()) new_movement = decision_movement.asContext(quantity=-decision_movement_quantity)
movement_collection_diff.addNewMovement(new_movement) movement_collection_diff.addNewMovement(new_movement)
compensated_quantity += decision_movement.getQuantity() compensated_quantity += decision_movement_quantity
else: else:
updatable_compensation_movement = decision_movement updatable_compensation_movement = decision_movement
# Not Frozen can be updated # Not Frozen can be updated
...@@ -336,9 +337,9 @@ class RuleMixin: ...@@ -336,9 +337,9 @@ class RuleMixin:
if decision_movement.isFrozen(): if decision_movement.isFrozen():
# Frozen must be compensated # Frozen must be compensated
if not _compare(divergence_tester_list, prevision_movement, decision_movement): if not _compare(divergence_tester_list, prevision_movement, decision_movement):
new_movement = decision_movement.asContext(quantity=-decision_movement.getQuantity()) new_movement = decision_movement.asContext(quantity=-decision_movement_quantity)
movement_collection_diff.addNewMovement(new_movement) movement_collection_diff.addNewMovement(new_movement)
compensated_quantity += decision_movement.getQuantity() compensated_quantity += decision_movement_quantity
else: else:
updatable_movement = decision_movement updatable_movement = decision_movement
# Not Frozen can be updated # Not Frozen can be updated
......
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