Commit 06bacd20 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

code cleanup and add a comment for current limitations.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@34001 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 652bccfe
...@@ -86,7 +86,8 @@ class TradeModelSolver(AcceptSolver): ...@@ -86,7 +86,8 @@ class TradeModelSolver(AcceptSolver):
if applied_rule.getSpecialiseReference() == 'default_trade_model_rule': if applied_rule.getSpecialiseReference() == 'default_trade_model_rule':
trade_model_related_movement_list.append(movement) trade_model_related_movement_list.append(movement)
# Second, apply changes on invoice lines. # Second, apply changes on invoice lines to simulation movements,
# then expand.
for movement in solved_movement_list: for movement in solved_movement_list:
for simulation_movement in movement.getDeliveryRelatedValueList(): for simulation_movement in movement.getDeliveryRelatedValueList():
value_dict = {} value_dict = {}
...@@ -104,13 +105,15 @@ class TradeModelSolver(AcceptSolver): ...@@ -104,13 +105,15 @@ class TradeModelSolver(AcceptSolver):
simulation_movement.expand() simulation_movement.expand()
# Third, adopt changes on trade model related lines. # Third, adopt changes on trade model related lines.
# XXX non-linear case is not yet supported.
for movement in trade_model_related_movement_list: for movement in trade_model_related_movement_list:
for solved_property in solved_property_list: for solved_property in solved_property_list:
if solved_property == 'quantity': if solved_property == 'quantity':
simulation_movement_list = movement.getDeliveryRelatedValueList()
total_quantity = sum( total_quantity = sum(
[x.getQuantity() for x in movement.getDeliveryRelatedValueList()]) [x.getQuantity() for x in simulation_movement_list])
movement.setQuantity(total_quantity) movement.setQuantity(total_quantity)
for simulation_movement in movement.getDeliveryRelatedValueList(): for simulation_movement in simulation_movement_list:
quantity = simulation_movement.getQuantity() quantity = simulation_movement.getQuantity()
delivery_ratio = quantity / total_quantity delivery_ratio = quantity / total_quantity
delivery_error = total_quantity * delivery_ratio - quantity delivery_error = total_quantity * delivery_ratio - quantity
......
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