Commit 424a6f8d authored by Sebastien Robin's avatar Sebastien Robin

changed isDivergent so that it will not use Delivery_zIsDivergent by default


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3762 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 118e39d0
...@@ -228,11 +228,11 @@ class Delivery(XMLObject): ...@@ -228,11 +228,11 @@ class Delivery(XMLObject):
####################################################### #######################################################
# Causality computation # Causality computation
security.declareProtected(Permissions.View, 'isConvergent') security.declareProtected(Permissions.View, 'isConvergent')
def isConvergent(self): def isConvergent(self,**kw):
""" """
Returns 0 if the target is not met Returns 0 if the target is not met
""" """
return int(not self.isDivergent()) return int(not self.isDivergent(**kw))
security.declareProtected(Permissions.View, 'isSimulated') security.declareProtected(Permissions.View, 'isSimulated')
def isSimulated(self): def isSimulated(self):
...@@ -253,7 +253,7 @@ class Delivery(XMLObject): ...@@ -253,7 +253,7 @@ class Delivery(XMLObject):
return 1 return 1
security.declareProtected(Permissions.View, 'isDivergent') security.declareProtected(Permissions.View, 'isDivergent')
def isDivergent(self): def isDivergent(self,fast=0,**kw):
""" """
Returns 1 if the target is not met according to the current information Returns 1 if the target is not met according to the current information
After and edit, the isOutOfTarget will be checked. If it is 1, After and edit, the isOutOfTarget will be checked. If it is 1,
...@@ -261,15 +261,15 @@ class Delivery(XMLObject): ...@@ -261,15 +261,15 @@ class Delivery(XMLObject):
emit targetUnreachable ! emit targetUnreachable !
""" """
if len(self.Delivery_zIsDivergent(uid=self.getUid())) > 0: # Delivery_zIsDivergent only works when object and simulation is
# reindexed, so if an user change the delivery, he must wait
# until everything is indexed, this is not acceptable for users
# so we should not use it by default (and may be we should remove)
if fast==1 and len(self.Delivery_zIsDivergent(uid=self.getUid())) > 0:
return 1 return 1
# Check if the total quantity equals the total of each simulation movement quantity # Check if the total quantity equals the total of each simulation movement quantity
for movement in self.getMovementList(): for movement in self.getMovementList():
d_quantity = movement.getQuantity() if movement.isDivergent():
simulation_quantity = 0.
for simulation_movement in movement.getDeliveryRelatedValueList():
simulation_quantity += float(simulation_movement.getCorrectedQuantity())
if d_quantity != simulation_quantity:
return 1 return 1
return 0 return 0
......
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