Commit 66a6999f authored by Jean-Paul Smets's avatar Jean-Paul Smets

Added validation of orphane movements for isDivergent


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@130 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 2ad8d123
...@@ -136,6 +136,13 @@ Une ligne tarifaire.""" ...@@ -136,6 +136,13 @@ Une ligne tarifaire."""
if kw.has_key('item_id_list'): if kw.has_key('item_id_list'):
self._setItemIdList( kw['item_id_list'] ) self._setItemIdList( kw['item_id_list'] )
security.declareProtected(Permissions.View, 'isDivergent')
def isDivergent(self):
"""
For DeliveryCell, consider orphane
"""
return Movement.isDivergent(self) or (not self.hasSimulationMovement())
security.declareProtected( Permissions.ModifyPortalContent, 'hasCellContent' ) security.declareProtected( Permissions.ModifyPortalContent, 'hasCellContent' )
def hasCellContent(self, base_id='movement'): def hasCellContent(self, base_id='movement'):
""" """
......
...@@ -309,8 +309,10 @@ Une ligne tarifaire.""" ...@@ -309,8 +309,10 @@ Une ligne tarifaire."""
for cell in self.contentValues(filter={'portal_type': 'Delivery Cell'}): for cell in self.contentValues(filter={'portal_type': 'Delivery Cell'}):
if cell.isDivergent(): if cell.isDivergent():
return 1 return 1
if not cell.hasSimulationMovement():
return 1
else: else:
return Movement.isDivergent(self) return Movement.isDivergent(self) or (not self.hasSimulationMovement())
security.declareProtected(Permissions.ModifyPortalContent, 'applyTargetSolver') security.declareProtected(Permissions.ModifyPortalContent, 'applyTargetSolver')
def applyTargetSolver(self, solver): def applyTargetSolver(self, solver):
......
...@@ -419,3 +419,9 @@ a service in a public administration).""" ...@@ -419,3 +419,9 @@ a service in a public administration)."""
def getExplanationValue(self): def getExplanationValue(self):
# This method allows to group Delivery movements and Simulation movements in a different way # This method allows to group Delivery movements and Simulation movements in a different way
return self.getDeliveryValue() return self.getDeliveryValue()
# Simulation
security.declareProtected(Permissions.View, 'hasSimulationMovement')
self hasSimulationMovement(self):
return len(self.getDeliveryRelatedValueList()) > 0 or len(self.getOrderRelatedValueList()) > 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