Commit 757672c2 authored by Yusuke Muraoka's avatar Yusuke Muraoka

- modified TransformationRule to use Business Process

  instead of Supply Chain.
- added/changed some features for above modified.



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27271 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 033bc689
...@@ -185,3 +185,11 @@ class BusinessProcess(Path, XMLObject): ...@@ -185,3 +185,11 @@ class BusinessProcess(Path, XMLObject):
def isStopDateReferential(self): def isStopDateReferential(self):
return self.getReferentialDate() == 'stop_date' return self.getReferentialDate() == 'stop_date'
def getTradePhaseList(self):
"""
Returns all trade_phase of this business process
"""
path_list = self.objectValues(portal_type=self.getPortalBusinessPathTypeList())
return filter(None, [path.getTradePhase()
for path in path_list])
...@@ -161,8 +161,10 @@ class BusinessState(XMLObject): ...@@ -161,8 +161,10 @@ class BusinessState(XMLObject):
""" """
remaining_trade_phase_list = [] remaining_trade_phase_list = []
for path in self.getPredecessorRelatedValueList(): for path in self.getPredecessorRelatedValueList():
if not (path.isCompleted(explanation) or # XXX When no simulations related to path, what should path.isCompleted return?
path.isPartiallyCompleted(explanation)): # if True we don't have way to add remaining trade phases to new movement
if not (path._getRelatedSimulationMovementList(explanation) and
path.isCompleted(explanation)):
remaining_trade_phase_list += path.getTradePhaseValueList() remaining_trade_phase_list += path.getTradePhaseValueList()
# collect to successor direction recursively # collect to successor direction recursively
......
...@@ -42,6 +42,8 @@ from Products.ERP5.Document.Predicate import Predicate ...@@ -42,6 +42,8 @@ from Products.ERP5.Document.Predicate import Predicate
from Products.CMFCategory.Renderer import Renderer from Products.CMFCategory.Renderer import Renderer
from Products.ERP5.AggregatedAmountList import AggregatedAmountList from Products.ERP5.AggregatedAmountList import AggregatedAmountList
from zLOG import LOG, WARNING
class Transformation(XMLObject, Predicate, Variated): class Transformation(XMLObject, Predicate, Variated):
""" """
Build of material - contains a list of transformed resources Build of material - contains a list of transformed resources
...@@ -223,7 +225,9 @@ class Transformation(XMLObject, Predicate, Variated): ...@@ -223,7 +225,9 @@ class Transformation(XMLObject, Predicate, Variated):
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getAggregatedAmountList') 'getAggregatedAmountList')
def getAggregatedAmountList(self, context=None, REQUEST=None, def getAggregatedAmountList(self, context=None, REQUEST=None,
ind_phase_url_list=None, trade_phase_list=None,
# obsolete, use trade_phase_list instead
ind_phase_url_list=None,
rejected_resource_uid_list=None, rejected_resource_uid_list=None,
context_quantity=0,**kw): context_quantity=0,**kw):
""" """
...@@ -247,8 +251,14 @@ class Transformation(XMLObject, Predicate, Variated): ...@@ -247,8 +251,14 @@ class Transformation(XMLObject, Predicate, Variated):
transformation_line_list = [] transformation_line_list = []
for transformation in ([self]+template_transformation_list): for transformation in ([self]+template_transformation_list):
transformation_line_list.extend(transformation.objectValues()) transformation_line_list.extend(transformation.objectValues())
# Get only lines related to a precise trade_phase
if trade_phase_list is not None:
transformation_line_list = filter(
lambda line: line.getTradePhase() in trade_phase_list,
transformation_line_list)
# Get only lines related to a precise industrial_phase # Get only lines related to a precise industrial_phase
if ind_phase_url_list is not None: if ind_phase_url_list is not None:
LOG("Transformation", WARNING, "ind_phase_list is obsolete")
new_transf_line_list = [] new_transf_line_list = []
for line in transformation_line_list: for line in transformation_line_list:
ind_ph = line.getIndustrialPhaseValue() ind_ph = line.getIndustrialPhaseValue()
......
This diff is collapsed.
...@@ -85,3 +85,7 @@ class IBusinessProcess(IBusinessCompletable, IBusinessBuildable): ...@@ -85,3 +85,7 @@ class IBusinessProcess(IBusinessCompletable, IBusinessBuildable):
'explanation' is the Order or Item or Document which is the 'explanation' is the Order or Item or Document which is the
cause of a root applied rule in the simulation cause of a root applied rule in the simulation
""" """
def getTradePhaseList(self):
"""Returns list of all trade_phase of this Business Process
"""
This diff is collapsed.
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