Commit 82562e51 authored by Łukasz Nowak's avatar Łukasz Nowak

- enable BPM related isFrozen checking, only if BPM was used to generate movement


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27968 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent e1e0860b
...@@ -497,25 +497,33 @@ class Movement(XMLObject, Amount): ...@@ -497,25 +497,33 @@ class Movement(XMLObject, Amount):
'isFrozen') 'isFrozen')
def isFrozen(self): def isFrozen(self):
""" """
Returns the frozen status of this movemnt. Returns the frozen status of this movement.
a movement in started, stopped, delivered is automatically frozen. a movement in started, stopped, delivered is automatically frozen.
If frozen is locally set to '0', we must check for a parent set to '1', in If frozen is locally set to '0', we must check for a parent set to '1', in
which case, we want the children to be frozen as well. which case, we want the children to be frozen as well.
BPM evaluation allows to set frozen state list per Business Path.
""" """
business_path = self.getCausalityValue(portal_type='Business Path')
if business_path is None:
# XXX Hardcoded # XXX Hardcoded
# Maybe, we should use getPortalCurrentInventoryStateList # Maybe, we should use getPortalCurrentInventoryStateList
# and another portal method for cancelled (and deleted) # and another portal method for cancelled (and deleted)
# LOG("Movement, isFrozen", DEBUG, "Hardcoded state list") # LOG("Movement, isFrozen", DEBUG, "Hardcoded state list")
if self.getSimulationState() in ('stopped', 'delivered', 'cancelled'): if self.getSimulationState() in ('stopped', 'delivered', 'cancelled'):
return 1 return 1
else:
# conditional BPM enabled frozen state check
LOG("Movement.isFrozen", WARNING, "%s is using BPM experimental \
evaluation" % self.getPath())
# BPM dynamic configuration
if self.getSimulationState() in business_path.getFrozenStateList():
return True
# manually frozen
if self._baseIsFrozen() == 0: if self._baseIsFrozen() == 0:
self._baseSetFrozen(None) self._baseSetFrozen(None)
return self._baseGetFrozen() or 0 return self._baseGetFrozen() or False
# Future implementation - for information
path = self.getCausalityValue()
if path is not None:
return self.getSimulationState() in path.getCompletedSimulationStateList()
return False
security.declareProtected( Permissions.AccessContentsInformation, security.declareProtected( Permissions.AccessContentsInformation,
'getExplanation') 'getExplanation')
......
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