Commit 0d8d8b08 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

implement QuantitySplitSolver.solve().

* simulation movements are delivery related value of delivery line, not of self.
* delivery of a new simulation movement should be removed.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@31311 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d6f84528
...@@ -65,13 +65,15 @@ class QuantitySplitSolver(XMLObject): ...@@ -65,13 +65,15 @@ class QuantitySplitSolver(XMLObject):
""" """
for delivery_line in self.getDeliveryValueList(): for delivery_line in self.getDeliveryValueList():
decision_quantity = delivery_line.getQuantity() decision_quantity = delivery_line.getQuantity()
simulation_movement_list = self.getDeliveryRelatedValueList() simulation_movement_list = delivery_line.getDeliveryRelatedValueList()
delivery_solver = self.portal_solvers.newDeliverySolver(self.getDeliverySolver(), simulation_movement_list) delivery_solver = self.portal_solvers.newDeliverySolver(self.getDeliverySolver(), simulation_movement_list)
# Update the quantity using delivery solver algorithm # Update the quantity using delivery solver algorithm
split_list = delivery_solver.setTotalQuantity(decision_quantity) split_list = delivery_solver.setTotalQuantity(decision_quantity)
# Create split movements # Create split movements
for (simulation_movement, split_quantity) in split_list: for (simulation_movement, split_quantity) in split_list:
new_movement = simulation_movement.copy() # Copy at same level new_movement = simulation_movement.Base_createCloneDocument(
batch_mode=True) # Copy at same level
new_movement._setDelivery(None)
new_movement._setQuantity(split_quantity) new_movement._setQuantity(split_quantity)
new_movement._setStartDate(self.getStartDate()) new_movement._setStartDate(self.getStartDate())
new_movement._setStopDate(self.getStopDate()) new_movement._setStopDate(self.getStopDate())
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