Commit ca39abc2 authored by Łukasz Nowak's avatar Łukasz Nowak

- revert 27902 - docstrings are needed by Zope, until proper solution is...

 - revert 27902 - docstrings are needed by Zope, until proper solution is found and applied globally it shall be not implemented in specific cases


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27903 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c4b16eb6
...@@ -176,6 +176,8 @@ class BusinessPath(Path): ...@@ -176,6 +176,8 @@ class BusinessPath(Path):
# IBusinessBuildable implementation # IBusinessBuildable implementation
def isBuildable(self, explanation): def isBuildable(self, explanation):
"""
"""
if self.isCompleted(explanation): if self.isCompleted(explanation):
return False # No need to build what was already built return False # No need to build what was already built
if self.isFrozen(explanation): if self.isFrozen(explanation):
...@@ -193,6 +195,9 @@ class BusinessPath(Path): ...@@ -193,6 +195,9 @@ class BusinessPath(Path):
""" """
def build(self, explanation): def build(self, explanation):
"""
Build
"""
builder_list = self.getBuilderList() # Missing method builder_list = self.getBuilderList() # Missing method
for builder in builder_list: for builder in builder_list:
builder.build(causality_uid=self.getUid()) # This is one way of doing builder.build(causality_uid=self.getUid()) # This is one way of doing
...@@ -208,6 +213,10 @@ class BusinessPath(Path): ...@@ -208,6 +213,10 @@ class BusinessPath(Path):
# IBusinessCompletable implementation # IBusinessCompletable implementation
def isCompleted(self, explanation): def isCompleted(self, explanation):
"""
Looks at all simulation related movements
and checks the simulation_state of the delivery
"""
acceptable_state_list = self.getCompletedStateList() acceptable_state_list = self.getCompletedStateList()
for movement in self._getRelatedSimulationMovementList(explanation): for movement in self._getRelatedSimulationMovementList(explanation):
if movement.getSimulationState() not in acceptable_state_list: if movement.getSimulationState() not in acceptable_state_list:
...@@ -215,6 +224,10 @@ class BusinessPath(Path): ...@@ -215,6 +224,10 @@ class BusinessPath(Path):
return True return True
def isPartiallyCompleted(self, explanation): def isPartiallyCompleted(self, explanation):
"""
Looks at all simulation related movements
and checks the simulation_state of the delivery
"""
acceptable_state_list = self.getCompletedStateList() acceptable_state_list = self.getCompletedStateList()
for movement in self._getRelatedSimulationMovementList(explanation): for movement in self._getRelatedSimulationMovementList(explanation):
if movement.getSimulationState() in acceptable_state_list: if movement.getSimulationState() in acceptable_state_list:
...@@ -222,6 +235,10 @@ class BusinessPath(Path): ...@@ -222,6 +235,10 @@ class BusinessPath(Path):
return False return False
def isFrozen(self, explanation): def isFrozen(self, explanation):
"""
Looks at all simulation related movements
and checks if frozen
"""
movement_list = self._getRelatedSimulationMovementList(explanation) movement_list = self._getRelatedSimulationMovementList(explanation)
if len(movement_list) == 0: if len(movement_list) == 0:
return False # Nothing to be considered as Frozen return False # Nothing to be considered as Frozen
...@@ -270,6 +287,13 @@ class BusinessPath(Path): ...@@ -270,6 +287,13 @@ class BusinessPath(Path):
return expected_date - self.getLeadTime() return expected_date - self.getLeadTime()
def getExpectedStopDate(self, explanation, predecessor_date=None, *args, **kwargs): def getExpectedStopDate(self, explanation, predecessor_date=None, *args, **kwargs):
"""
Returns the expected stop date for this
path based on the explanation.
predecessor_date -- if provided, computes the date base on the
date value provided
"""
return self._getExpectedDate(explanation, return self._getExpectedDate(explanation,
self._getRootExplanationExpectedStopDate, self._getRootExplanationExpectedStopDate,
self._getPredecessorExpectedStopDate, self._getPredecessorExpectedStopDate,
......
...@@ -142,6 +142,9 @@ class BusinessProcess(Path, XMLObject): ...@@ -142,6 +142,9 @@ class BusinessProcess(Path, XMLObject):
return filter(lambda x:x.isPartiallyCompleted(explanation), self.getStateValueList()) return filter(lambda x:x.isPartiallyCompleted(explanation), self.getStateValueList())
def getLatestCompletedStateValue(self, explanation): def getLatestCompletedStateValue(self, explanation):
"""
Returns the most advanced completed state
"""
for state in self.getCompletedStateValueList(explanation): for state in self.getCompletedStateValueList(explanation):
for path in state.getPredecessorRelatedValueList(): for path in state.getPredecessorRelatedValueList():
if not path.isCompleted(explanation): if not path.isCompleted(explanation):
...@@ -149,6 +152,9 @@ class BusinessProcess(Path, XMLObject): ...@@ -149,6 +152,9 @@ class BusinessProcess(Path, XMLObject):
return None return None
def getLatestPartiallyCompletedStateValue(self, explanation): def getLatestPartiallyCompletedStateValue(self, explanation):
"""
Returns the most advanced completed state
"""
for state in self.getCompletedStateValueList(explanation): for state in self.getCompletedStateValueList(explanation):
for path in state.getPredecessorRelatedValueList(): for path in state.getPredecessorRelatedValueList():
if not path.isPartiallyCompleted(explanation): if not path.isPartiallyCompleted(explanation):
...@@ -156,6 +162,9 @@ class BusinessProcess(Path, XMLObject): ...@@ -156,6 +162,9 @@ class BusinessProcess(Path, XMLObject):
return None return None
def getLatestCompletedStateValueList(self, explanation): def getLatestCompletedStateValueList(self, explanation):
"""
Returns the most advanced completed state
"""
result = [] result = []
for state in self.getCompletedStateValueList(explanation): for state in self.getCompletedStateValueList(explanation):
for path in state.getPredecessorRelatedValueList(): for path in state.getPredecessorRelatedValueList():
...@@ -164,6 +173,9 @@ class BusinessProcess(Path, XMLObject): ...@@ -164,6 +173,9 @@ class BusinessProcess(Path, XMLObject):
return result return result
def getLatestPartiallyCompletedStateValueList(self, explanation): def getLatestPartiallyCompletedStateValueList(self, explanation):
"""
Returns the most advanced completed state
"""
result = [] result = []
for state in self.getCompletedStateValueList(explanation): for state in self.getCompletedStateValueList(explanation):
for path in state.getPredecessorRelatedValueList(): for path in state.getPredecessorRelatedValueList():
...@@ -185,6 +197,9 @@ class BusinessProcess(Path, XMLObject): ...@@ -185,6 +197,9 @@ class BusinessProcess(Path, XMLObject):
return self.getReferentialDate() == 'stop_date' return self.getReferentialDate() == 'stop_date'
def getTradePhaseList(self): def getTradePhaseList(self):
"""
Returns all trade_phase of this business process
"""
path_list = self.objectValues(portal_type=self.getPortalBusinessPathTypeList()) path_list = self.objectValues(portal_type=self.getPortalBusinessPathTypeList())
return filter(None, [path.getTradePhase() return filter(None, [path.getTradePhase()
for path in path_list]) for path in path_list])
......
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