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): ...@@ -71,7 +71,6 @@ class QuantityDivergenceTester(PropertyDivergenceTester):
d_quantity = delivery.getQuantity() d_quantity = delivery.getQuantity()
quantity = simulation_movement.getCorrectedQuantity() quantity = simulation_movement.getCorrectedQuantity()
d_error = simulation_movement.getDeliveryError()
extra_parameters = dict() extra_parameters = dict()
if abs(quantity - d_quantity) < 1: if abs(quantity - d_quantity) < 1:
...@@ -98,8 +97,6 @@ class QuantityDivergenceTester(PropertyDivergenceTester): ...@@ -98,8 +97,6 @@ class QuantityDivergenceTester(PropertyDivergenceTester):
return [message] return [message]
if d_quantity is None: if d_quantity is None:
d_quantity = 0 d_quantity = 0
if d_error is None:
d_error = 0
delivery_ratio = simulation_movement.getDeliveryRatio() delivery_ratio = simulation_movement.getDeliveryRatio()
# if the delivery_ratio is None, make sure that we are # if the delivery_ratio is None, make sure that we are
# divergent even if the delivery quantity is 0 # divergent even if the delivery quantity is 0
...@@ -110,7 +107,7 @@ class QuantityDivergenceTester(PropertyDivergenceTester): ...@@ -110,7 +107,7 @@ class QuantityDivergenceTester(PropertyDivergenceTester):
if delivery_ratio == 0 and quantity > 0: if delivery_ratio == 0 and quantity > 0:
return [message] return [message]
if not self.compare(d_quantity, quantity+d_error): if not self.compare(d_quantity, quantity):
return [message] return [message]
return [] return []
......
...@@ -438,15 +438,13 @@ class SimulationMovement(Movement): ...@@ -438,15 +438,13 @@ class SimulationMovement(Movement):
'getCorrectedQuantity') 'getCorrectedQuantity')
def getCorrectedQuantity(self): 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() quantity = self.getQuantity()
profit_quantity = self.getProfitQuantity() profit_quantity = self.getProfitQuantity() or 0
if quantity is not None: delivery_error = self.getDeliveryError() or 0
if profit_quantity: return quantity - profit_quantity + delivery_error
return quantity - profit_quantity
return quantity
return None
security.declareProtected( Permissions.AccessContentsInformation, security.declareProtected( Permissions.AccessContentsInformation,
'getRootSimulationMovement') '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