From bc62ea97492b6a35485fd4e54d033b465a5ec1f3 Mon Sep 17 00:00:00 2001
From: Kazuhiko Shiozaki <kazuhiko@nexedi.com>
Date: Fri, 25 Mar 2011 12:51:28 +0000
Subject: [PATCH] In adopting 'quantity', we need to recalculate delivery_ratio
 for all related simulation movements.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@44621 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/Document/AdoptSolver.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/product/ERP5/Document/AdoptSolver.py b/product/ERP5/Document/AdoptSolver.py
index 0b4c1f3483..28c147169a 100644
--- a/product/ERP5/Document/AdoptSolver.py
+++ b/product/ERP5/Document/AdoptSolver.py
@@ -79,8 +79,11 @@ class AdoptSolver(SolverMixin, ConfigurableMixin, XMLObject):
       for solved_property in solved_property_list:
         # XXX hardcoded
         if solved_property == 'quantity':
+          # For 'quantity' case, we need to recalculate delivery_ratio
+          # for all related simulation movements.
+          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 simulation_movement_list:
             quantity = simulation_movement.getQuantity()
-- 
2.30.9