diff --git a/product/ERP5/Document/DeliveryCell.py b/product/ERP5/Document/DeliveryCell.py index 64d6eaf14c963c02ee154c3ccebda23e953fd334..4e1b75637ceccd8bb3b1ce9530ce4efb4a8485c9 100755 --- a/product/ERP5/Document/DeliveryCell.py +++ b/product/ERP5/Document/DeliveryCell.py @@ -136,6 +136,13 @@ Une ligne tarifaire.""" if kw.has_key('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' ) def hasCellContent(self, base_id='movement'): """ diff --git a/product/ERP5/Document/DeliveryLine.py b/product/ERP5/Document/DeliveryLine.py index 2bd62ff0e4878432c849f15ca7edfc19cb02068e..bcabb633b37cfebf450b6d121a8250e17aaf2932 100755 --- a/product/ERP5/Document/DeliveryLine.py +++ b/product/ERP5/Document/DeliveryLine.py @@ -309,8 +309,10 @@ Une ligne tarifaire.""" for cell in self.contentValues(filter={'portal_type': 'Delivery Cell'}): if cell.isDivergent(): return 1 + if not cell.hasSimulationMovement(): + return 1 else: - return Movement.isDivergent(self) + return Movement.isDivergent(self) or (not self.hasSimulationMovement()) security.declareProtected(Permissions.ModifyPortalContent, 'applyTargetSolver') def applyTargetSolver(self, solver): diff --git a/product/ERP5/Document/Movement.py b/product/ERP5/Document/Movement.py index 9a0244356cc3d8783f70b3de7ef60ae28db9b67d..827de929e82c901160203b87cf0e3265e5f5795c 100755 --- a/product/ERP5/Document/Movement.py +++ b/product/ERP5/Document/Movement.py @@ -419,3 +419,9 @@ a service in a public administration).""" def getExplanationValue(self): # This method allows to group Delivery movements and Simulation movements in a different way return self.getDeliveryValue() + + # Simulation + security.declareProtected(Permissions.View, 'hasSimulationMovement') + self hasSimulationMovement(self): + return len(self.getDeliveryRelatedValueList()) > 0 or len(self.getOrderRelatedValueList()) > 0 +