Commit ac59174e authored by Jérome Perrin's avatar Jérome Perrin

corrected quantity should take delivery error into account, otherwise we will

expand different quantites than the delivery line


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27242 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent ba102d3c
......@@ -71,7 +71,6 @@ class QuantityDivergenceTester(PropertyDivergenceTester):
d_quantity = delivery.getQuantity()
quantity = simulation_movement.getCorrectedQuantity()
d_error = simulation_movement.getDeliveryError()
extra_parameters = dict()
if abs(quantity - d_quantity) < 1:
......@@ -98,8 +97,6 @@ class QuantityDivergenceTester(PropertyDivergenceTester):
return [message]
if d_quantity is None:
d_quantity = 0
if d_error is None:
d_error = 0
delivery_ratio = simulation_movement.getDeliveryRatio()
# if the delivery_ratio is None, make sure that we are
# divergent even if the delivery quantity is 0
......@@ -110,7 +107,7 @@ class QuantityDivergenceTester(PropertyDivergenceTester):
if delivery_ratio == 0 and quantity > 0:
return [message]
if not self.compare(d_quantity, quantity+d_error):
if not self.compare(d_quantity, quantity):
return [message]
return []
......
......@@ -438,15 +438,13 @@ class SimulationMovement(Movement):
'getCorrectedQuantity')
def getCorrectedQuantity(self):
"""
Returns the quantity property deducted by the possible profit_quantity
Returns the quantity property deducted by the possible profit_quantity and
taking into account delivery error
"""
quantity = self.getQuantity()
profit_quantity = self.getProfitQuantity()
if quantity is not None:
if profit_quantity:
return quantity - profit_quantity
return quantity
return None
profit_quantity = self.getProfitQuantity() or 0
delivery_error = self.getDeliveryError() or 0
return quantity - profit_quantity + delivery_error
security.declareProtected( Permissions.AccessContentsInformation,
'getRootSimulationMovement')
......
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