Commit d390555c authored by Julien Muchembled's avatar Julien Muchembled

Fix testLegacyBPMCore

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@41658 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 0f85d581
......@@ -35,8 +35,54 @@ def patch():
composition._LEGACY_SIMULATION = True
## Movement
from Products.ERP5.Document.Movement import Movement
def isFrozen(self):
"""
Returns the frozen status of this movement.
a movement in stopped, delivered or cancelled states is automatically frozen.
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.
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
# Maybe, we should use getPortalCurrentInventoryStateList
# and another portal method for cancelled (and deleted)
# LOG("Movement, isFrozen", DEBUG, "Hardcoded state list")
if self.getSimulationState() in ('stopped', 'delivered', 'cancelled'):
return 1
else:
# conditional BPM enabled frozen state check
# BPM dynamic configuration
if self.getSimulationState() in business_path.getFrozenStateList():
return True
# manually frozen
frozen = self._baseIsFrozen()
if frozen == 0:
self._baseSetFrozen(None)
return frozen or False
Movement.isFrozen = isFrozen
## SimulationMovement
from Products.ERP5.Document.SimulationMovement import SimulationMovement
del SimulationMovement.isFrozen
def isCompleted(self):
"""Zope publisher docstring. Documentation in ISimulationMovement"""
# only available in BPM, so fail totally in case of working without BPM
return self.getSimulationState() in self.getCausalityValue(
portal_type='Business Path').getCompletedStateList()
SimulationMovement.isCompleted = isCompleted
def asComposedDocument(self, *args, **kw):
# XXX: What delivery should be used to find amount generator lines ?
# With the currently enabled code, entire branches in the simulation
......@@ -57,7 +103,22 @@ def patch():
return self.getOrderValue().asComposedDocument(*args, **kw)
self = grand_parent
from Products.ERP5.Document.SimulationMovement import SimulationMovement
SimulationMovement.asComposedDocument = asComposedDocument
def isBuildable(self):
"""Simulation Movement buildable logic"""
if self.getDeliveryValue() is not None:
# already delivered
return False
# might be buildable - business path dependent
business_path = self.getCausalityValue(portal_type='Business Path')
explanation_value = self.getExplanationValue()
if business_path is None or explanation_value is None:
return True
return len(business_path.filterBuildableMovementList([self])) == 1
SimulationMovement.isBuildable = isBuildable
patch()
7
\ No newline at end of file
8
\ No newline at end of file
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