From 06bacd20116fb9d5be2de7b7e06522d6e4376e5c Mon Sep 17 00:00:00 2001 From: Kazuhiko Shiozaki <kazuhiko@nexedi.com> Date: Tue, 23 Mar 2010 13:10:18 +0000 Subject: [PATCH] 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 --- product/ERP5/Document/TradeModelSolver.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/product/ERP5/Document/TradeModelSolver.py b/product/ERP5/Document/TradeModelSolver.py index c6bf8e6d65..1b981d7aed 100644 --- a/product/ERP5/Document/TradeModelSolver.py +++ b/product/ERP5/Document/TradeModelSolver.py @@ -86,7 +86,8 @@ class TradeModelSolver(AcceptSolver): if applied_rule.getSpecialiseReference() == 'default_trade_model_rule': 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 simulation_movement in movement.getDeliveryRelatedValueList(): value_dict = {} @@ -104,13 +105,15 @@ class TradeModelSolver(AcceptSolver): simulation_movement.expand() # 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 solved_property in solved_property_list: if solved_property == 'quantity': + simulation_movement_list = movement.getDeliveryRelatedValueList() total_quantity = sum( - [x.getQuantity() for x in movement.getDeliveryRelatedValueList()]) + [x.getQuantity() for x in simulation_movement_list]) movement.setQuantity(total_quantity) - for simulation_movement in movement.getDeliveryRelatedValueList(): + for simulation_movement in simulation_movement_list: quantity = simulation_movement.getQuantity() delivery_ratio = quantity / total_quantity delivery_error = total_quantity * delivery_ratio - quantity -- 2.30.9