Commit 74710532 authored by Romain Courteaud's avatar Romain Courteaud

Distribute equally ratio to all movements when total quantity is 0.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3213 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a0f5a7c4
......@@ -247,6 +247,7 @@ class PathMovementGroup(RootMovementGroup):
#LOG('PathGroup.__init__ source_section',0,self.source_section)
self.destination_section = movement.getDestinationSection()
#LOG('PathGroup.__init__ destination_section',0,self.destination_section)
self.setGroupEdit(
source_value=movement.getSourceValue(),
destination_value=movement.getDestinationValue(),
......@@ -254,7 +255,6 @@ class PathMovementGroup(RootMovementGroup):
destination_section_value=movement.getDestinationSectionValue(),
)
def test(self,movement):
if movement.getSource() == self.source and \
movement.getDestination() == self.destination and \
......@@ -312,7 +312,7 @@ class ResourceMovementGroup(RootMovementGroup):
RootMovementGroup.__init__(self, movement=movement, **kw)
self.resource = movement.getResource()
self.setGroupEdit(
resource_value=self.resource
resource_value=movement.getResourceValue()
)
def test(self,movement):
......@@ -475,9 +475,15 @@ class FakeMovement:
for movement in self.__movement_list:
total_quantity += movement.getQuantity()
for movement in self.__movement_list:
quantity = movement.getQuantity()
movement.setDeliveryRatio(quantity*delivery_ratio/total_quantity)
if total_quantity != 0:
for movement in self.__movement_list:
quantity = movement.getQuantity()
movement.setDeliveryRatio(quantity*delivery_ratio/total_quantity)
else:
# Distribute equally ratio to all movement
mvt_ratio = 1 / len(self.__movement_list)
for movement in self.__movement_list:
movement.setDeliveryRatio(mvt_ratio)
def getPrice(self):
"""
......
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