Commit 73918374 authored by Jean-Paul Smets's avatar Jean-Paul Smets

Extended getCompletionDate to support the case in which the CompletionDate is...

Extended getCompletionDate to support the case in which the CompletionDate is found on the delivery line, whenever simulation movement has not yet been built (but is it really useful ?)

git-svn-id: https://svn.erp5.org/repos/public/erp5/sandbox/amount_generator@36054 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d9a0deeb
...@@ -64,6 +64,8 @@ class BusinessPath(Path, Predicate): ...@@ -64,6 +64,8 @@ class BusinessPath(Path, Predicate):
TODO: TODO:
- IArrowBase implementation has too many comments which need to be - IArrowBase implementation has too many comments which need to be
fixed fixed
- _getExplanationRelatedMovementValueList may be superfluous. Make
sure it is really needed
""" """
meta_type = 'ERP5 Business Path' meta_type = 'ERP5 Business Path'
portal_type = 'Business Path' portal_type = 'Business Path'
...@@ -102,6 +104,10 @@ class BusinessPath(Path, Predicate): ...@@ -102,6 +104,10 @@ class BusinessPath(Path, Predicate):
explanation_cache = _getExplanationCache(explanation) explanation_cache = _getExplanationCache(explanation)
return explanation_cache.getBusinessPathRelatedSimulationMovementValueList(self) return explanation_cache.getBusinessPathRelatedSimulationMovementValueList(self)
def _getExplanationRelatedMovementValueList(self, explanation):
explanation_cache = _getExplanationCache(explanation)
return explanation_cache.getBusinessPathRelatedMovementValueList(self)
# IArrowBase implementation # IArrowBase implementation
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getSourceArrowBaseCategoryList') 'getSourceArrowBaseCategoryList')
...@@ -256,15 +262,20 @@ class BusinessPath(Path, Predicate): ...@@ -256,15 +262,20 @@ class BusinessPath(Path, Predicate):
explanation -- the Order, Order Line, Delivery or Delivery Line which explanation -- the Order, Order Line, Delivery or Delivery Line which
implicitely defines a simulation subtree and a union implicitely defines a simulation subtree and a union
business process. business process.
NOTE:
It seems that current implementation makes sense mostly in the
context of a root explanation.
""" """
date_list = [] date_list = []
# First, let us try to find simulation movements in simulation
# (hoping that it is already built)
for movement in self._getExplanationRelatedSimulationMovementValueList(explanation): for movement in self._getExplanationRelatedSimulationMovementValueList(explanation):
date_list.append(self.getMovementCompletionDate(movement)) date_list.append(self.getMovementCompletionDate(movement))
# Next, try to find delivery lines or cells which may provide
# a good definition of completion date.
if not date_list:
for movement in self._getExplanationRelatedMovementValueList(explanation):
date_list.append(self.getMovementCompletionDate(movement))
return max(date_list) return max(date_list)
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
......
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