Commit 2b4a50aa authored by Jérome Perrin's avatar Jérome Perrin

Use an alternate way of testing quantity when delivery quantity is 0.

For example one simulation movement quantity -1 and another simulation movement
of quantity 1 that becomes one delivery movement of quantity 0.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@30378 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent cf2de692
...@@ -104,8 +104,28 @@ class QuantityDivergenceTester(PropertyDivergenceTester): ...@@ -104,8 +104,28 @@ class QuantityDivergenceTester(PropertyDivergenceTester):
if delivery_ratio == 0 and quantity > 0: if delivery_ratio == 0 and quantity > 0:
return [message] return [message]
if d_quantity != 0.0:
if not self.compare(d_quantity, quantity): if not self.compare(d_quantity, quantity):
return [message] return [message]
else:
# A delivery quantity of 0 is an exceptional case that we cannot really
# handle with the current approach of delivery ratio.
d_quantity = delivery.getQuantity()
quantity = sum([m.getCorrectedQuantity() for m in
delivery.getDeliveryRelatedValueList(
portal_type='Simulation Movement')])
if not self.compare(d_quantity, quantity):
return [DivergenceMessage(
object_relative_url= delivery.getRelativeUrl(),
divergence_scope='quantity',
simulation_movement = simulation_movement,
decision_value = d_quantity ,
prevision_value = quantity,
tested_property='quantity',
message='Quantity',
**extra_parameters)]
return [] return []
def compare(self, x, y): def compare(self, x, y):
......
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