Commit 28ba87df authored by Jean-Paul Smets's avatar Jean-Paul Smets

Minor changes made during code review and rewrite.

git-svn-id: https://svn.erp5.org/repos/public/erp5/sandbox/amount_generator@35545 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 89ee1adf
......@@ -43,15 +43,31 @@ class IBusinessPath(Interface):
delivery builders for all movements related to a given explanation.
"""
def getMovementCompletionDate(self, movement):
def getDeliveryBuilderValueList():
"""Return the list of delivery builders to invoke with
this Business Path.
NOTE: redundant with PropertySheet definition
"""
def getMovementCompletionDate(movement):
"""Returns the date of completion of the movemnet
based on paremeters of the business path. This complete date can be
based on paremeters of the business path. This completion date can be
the start date, the stop date, the date of a given workflow transition
on the explaining delivery, etc.
movement -- a Simulation Movement
"""
def getExpectedQuantity(amount):
"""Returns the new quantity for the provided amount taking
into account the efficiency or the quantity defined on the business path.
This is used to implement payment conditions or splitting production
over multiple path. The total of getExpectedQuantity for all business
path which are applicable should never exceed the original quantity.
The implementation of this validation is left to rules.
"""
def isCompleted(explanation):
"""returns True if all related simulation movements for this explanation
document are in a simulation state which is considered as completed
......
......@@ -39,14 +39,20 @@ class IBusinessPathProcess(Interface):
to Business Path completion status and expected completion dates.
"""
def getBusinessPathValueList(trade_phase=None, predecessor=None, successor=None):
def getBusinessPathValueList(trade_phase=None, context=None,
predecessor=None, successor=None, **kw):
"""Returns the list of contained Business Path documents
trade_phase -- filter by trade phase
context -- a context to test each Business Path on
and filter out Business Path which do not match
predecessor -- filter by trade state predecessor
successor -- filter by trade state successor
**kw -- same arguments as those passed to searchValues / contentValues
"""
def isBusinessPathCompleted(explanation, business_path):
......@@ -59,7 +65,8 @@ class IBusinessPathProcess(Interface):
business_path -- a Business Path document
"""
def getExpectedBusinessPathCompletionDate(explanation, business_path):
def getExpectedBusinessPathCompletionDate(explanation, business_path,
delay_mode=None):
"""Returns the expected completion date of given Business Path document
in the context of provided explanation.
......@@ -67,9 +74,13 @@ class IBusinessPathProcess(Interface):
implicitely defines a simulation subtree
business_path -- a Business Path document
delay_mode -- optional value to specify calculation mode ('min', 'max')
if no value specified use average delay
"""
def getExpectedBusinessPathStartAndStopDate(explanation, business_path):
def getExpectedBusinessPathStartAndStopDate(explanation, business_path,
delay_mode=None):
"""Returns the expected start and stop dates of given Business Path
document in the context of provided explanation.
......@@ -77,6 +88,9 @@ class IBusinessPathProcess(Interface):
implicitely defines a simulation subtree
business_path -- a Business Path document
delay_mode -- optional value to specify calculation mode ('min', 'max')
if no value specified use average delay
"""
class IBuildableBusinessPathProcess(Interface):
......@@ -96,6 +110,15 @@ class IBuildableBusinessPathProcess(Interface):
implicitely defines a simulation subtree
"""
def getPartiallyBuildableBusinessPathValueList(explanation):
"""Returns the list of Business Path which are partially buildable
by taking into account trade state dependencies between
Business Path.
explanation -- an Order, Order Line, Delivery or Delivery Line which
implicitely defines a simulation subtree
"""
def isBusinessPathBuildable(explanation, business_path):
"""Returns True if any of the related Simulation Movement
is buildable and if the predecessor trade state is completed.
......@@ -116,6 +139,16 @@ class IBuildableBusinessPathProcess(Interface):
business_path -- a Business Path document
"""
def isBuildable(explanation):
"""Returns True is this business process has at least one
Business Path which is buildable
"""
def isPartiallyBuildable(explanation):
"""Returns True is this business process has at least one
Business Path which is partially buildable
"""
class ITradeStateProcess(Interface):
"""Trade State Process interface specification
......@@ -219,7 +252,8 @@ class ITradeStateProcess(Interface):
trade_state -- a Trade State category
"""
def getExpectedTradeStateCompletionDate(explanation, trade_state):
def getExpectedTradeStateCompletionDate(explanation, trade_state,
delay_mode=None):
"""Returns the date at which the give trade state is expected
to be completed in the context of given explanation.
......@@ -227,6 +261,9 @@ class ITradeStateProcess(Interface):
implicitely defines a simulation subtree
trade_state -- a Trade State category
delay_mode -- optional value to specify calculation mode ('min', 'max')
if no value specified use average delay
"""
class ITradePhaseProcess(Interface):
......@@ -286,7 +323,8 @@ class ITradePhaseProcess(Interface):
trade_phase -- a Trade Phase category
"""
def getExpectedTradePhaseCompletionDate(explanation, trade_phase):
def getExpectedTradePhaseCompletionDate(explanation, trade_phase,
delay_mode=None):
"""Returns the date at which the give trade phase is expected
to be completed in the context of given explanation, taking
into account the graph of date constraints defined by business path
......@@ -296,6 +334,9 @@ class ITradePhaseProcess(Interface):
implicitely defines a simulation subtree
trade_phase -- a Trade Phase category
delay_mode -- optional value to specify calculation mode ('min', 'max')
if no value specified use average delay
"""
def getRemainingTradePhaseList(business_path, trade_phase_list=None):
......@@ -336,7 +377,7 @@ class IBusinessProcess(IBusinessPathProcess, IBuildableBusinessPathProcess,
implicitely defines a simulation subtree
"""
def getExpectedCompletionDate(explanation):
def getExpectedCompletionDate(explanation, delay_mode=None):
"""Returns the expected date at which all applicable Trade States and
Trade Phases are completed in the context of given explanation.
......
......@@ -34,6 +34,7 @@ from Products.ERP5.interfaces.property_recordable import IPropertyRecordable
from Products.ERP5.interfaces.movement import IMovement
from Products.ERP5.interfaces.divergence_controller import IDivergenceController
from Products.ERP5.interfaces.explainable import IExplainable
from zope.interface import Interface
class ISimulationMovement(IMovement, IPropertyRecordable, IDivergenceController, IExplainable):
"""Simulation Movement interface specification
......@@ -91,8 +92,8 @@ class ISimulationMovement(IMovement, IPropertyRecordable, IDivergenceController,
def isDeletable():
"""Returns True if this simulation movement can be deleted, False
else. A simulation movement can be deleted if all its children
can be deleted of if it has no child.
else. A simulation movement can be deleted if it is not frozen,
and if all its children can be deleted or if it has no child.
"""
def isCompleted():
......
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