Commit 86e0eb66 authored by Jean-Paul Smets's avatar Jean-Paul Smets

solved some conflicts manually

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27279 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent cc8c6e0d
##############################################################################
#
# Copyright (c) 2002 Nexedi SARL and Contributors. All Rights Reserved.
# Jean-Paul Smets-Solanes <jp@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from Interface import Interface
class Coordinate(Interface):
"""
Common Interface for all Coordinate objects
"""
def asText():
"""
returns the coordinate as a text string
This method usually tries to lookup a skin named ${PortalType}_asText and
to use this script to display the coordinate text.
"""
pass
def fromText(coordinate_text):
"""
modifies the coordinate according to the input text.
This method usually tries to lookup a skin named ${PortalType}_fromText and
to use this script to modify the properties of this document.
"""
pass
def standardTextFormat():
"""
returns a string which defines the standard
string format for that coordinate
"""
pass
##############################################################################
#
# Copyright (c) 2006 Nexedi SARL and Contributors. All Rights Reserved.
# Rafael Monnerat <rafael@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from Interface import Interface
class DivergenceTester(Interface):
"""
ERP5 Divergence Tester
"""
def test(simulation_movement):
"""
This is the fast method to test, return 0 or 1.
It depends if the simulation_movement is divergent or not.
"""
def explain(simulation_movement):
"""
This method returns a list of messages that contains
the divergence of the Delivery Line.
"""
##############################################################################
#
# Copyright (c) 2002 Nexedi SARL and Contributors. All Rights Reserved.
# Jean-Paul Smets-Solanes <jp@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from Interface import Interface
class Entity(Interface):
"""
Common Interface for Entity objects
"""
def getDefaultAddress():
"""
Returns the default address as a text string
"""
pass
def getDefaultAddressStreetAddress():
"""
Returns the default address street as a text string
"""
pass
def getDefaultAddressCity():
"""
Returns the default address city as a text string
"""
pass
def getDefaultAddressRegion():
"""
Returns the default address region as a text string
"""
pass
def getDefaultAddressZipCode():
"""
Returns the default address zip code as a text string
"""
pass
def getDefaultTelephone():
"""
Returns the default telephone as a text string
"""
pass
def getDefaultFax():
"""
Returns the default fax as a text string
"""
pass
def getDefaultEmail():
"""
Returns the default email as a text string
"""
pass
def setDefaultAddress(coordinate):
"""
Updates the default address from a standard text string
"""
pass
def setDefaultTelephone(coordinate):
"""
Updates the default telephone from a standard text string
"""
pass
def setDefaultFax(coordinate):
"""
Updates the default fax from a standard text string
"""
pass
def setDefaultEmail(coordinate):
"""
Updates the default email from a standard text string
"""
pass
##############################################################################
#
# Copyright (c) 2009 Nexedi SA and Contributors. All Rights Reserved.
# Jean-Paul Smets-Solanes <jp@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from Interface import Interface
class Expandable(Interface):
"""
An Expandable class provides methods which trigger
the generation of a root applied rule in the simulation
and its expansion.
"""
def expand(self, applied_rule_id=None, force=0, activate_kw=None, **kw):
"""
Expand the current Expandable class into the similation
"""
##############################################################################
#
# Copyright (c) 2009 Nexedi SARL and Contributors. All Rights Reserved.
# Jean-Paul Smets-Solanes <jp@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from zope.interface import Interface
class IAmount(Interface):
"""Amount interface specification
An amount represents a quantity of a given resource
in a given quantity unit. Optional efficiency can be
specified in order to represent a loss ratio to take
into account in calculations. Loss ratio is normally
used only in Path.
The Amount interface is useful each time
we need to add or substract amounts of resources
independently of a movement. This is the case for example
for all Transformation related classes.
Equations:
net_quantity = quantity * efficiency
TODO:
1. make sure getTotalPrice has or does not
have extra parameters (ex. rounding)
2. remove profit_quantity everywhere
3. remove target_quantity everywhere
4. consider how to make Interface compatible
with accessor generation (ex. getResource,
getQuantity, etc.)
5. consider creating an IPriceable interface
which is common to deliveries and amounts
"""
# Core API
def getQuantity():
"""
Returns the quantity of the resource
in the unit specified by the Amount
"""
def getResource():
"""
Returns the resource category relative URL
of the Amount
"""
def getQuantityUnit():
"""
Returns the quantity unit category relative URL
of the Amount
"""
def isCancellationAmount():
"""
A cancellation amount must be interpreted
reversely wrt. to the sign of quantity.
For example, a negative credit for a cancellation
amount is a negative credit, not a positive
debit.
A negative production quantity for a cancellation
amount is a cancelled production, not
a consumption
"""
# Net Quantity API
def getEfficiency():
"""
Returns the ratio of loss for the given amount. This
is only used in Path such as Transformation. In other
words, efficiency of movements is always 100%.
"""
def getNetQuantity():
"""
Returns the quantity multiplied by the ratio.
"""
# Price API
def getPrice():
"""
Returns the unit price of the resource
"""
def getTotalPrice():
"""
Returns total price ie. the unit price of the resource
multiplied by the quantity.
"""
# Conversion API
def getConvertedQuantity():
"""
Returns the quantity of the resource converted in the
management unit of the resource
"""
def getNetConvertedQuantity():
"""
Returns the net quantity of the resource converted in the
management unit of the resource
"""
# Make it possible to add amounts
def __add__(value):
"""Add an amount to another amount
'value' is an IAmount document
"""
def __sub__(value):
"""Substract an amount from another amount
'value' is an IAmount document
"""
def __mul__(value):
"""Multiply an Amount by a float
'value' is a float
"""
def __div__(value):
"""Divide an Amount by a float
'value' is a float
"""
##############################################################################
#
# Copyright (c) 2009 Nexedi SA and Contributors. All Rights Reserved.
# Jean-Paul Smets-Solanes <jp@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from zope.interface import Interface
class IArrow(Interface):
"""The Arrow lists the methods which are available to
access all source and destination categories of
a movement or of a delivery.
"""
def getSourceArrowBaseCategoryList():
"""Returns all categories which are used to define the source
of this Arrow
"""
def getDestinationArrowBaseCategoryList():
"""Returns all categories which are used to define the destination
of this Arrow
"""
\ No newline at end of file
##############################################################################
#
# Copyright (c) 2009 Nexedi SA and Contributors. All Rights Reserved.
# Jean-Paul Smets-Solanes <jp@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from zope.interface import Interface
class IBusinessBuildable(Interface):
"""Business Buildable interface specification
"""
def isBuildable(explanation):
"""Returns True if any of the related Simulation Movement
is buildable and if the predecessor state is completed.
'explanation' is the Order or Item or Document which is the
cause of a root applied rule in the simulation
"""
def isPartiallyBuildable(explanation):
"""Returns True if any of the related Simulation Movement
is buildable and if the predecessor state is partially completed.
'explanation' is the Order or Item or Document which is the
cause of a root applied rule in the simulation
"""
def isFrozen(explanation):
"""Returns True if all related movements in the simulation
are frozen
'explanation' is the Order or Item or Document which is the
cause of a root applied rule in the simulation
XXX - could be redundant with isBuildable
(isFrozen = not isBuildable ?)
"""
def build(explanation):
"""Builds all related movements in the simulation
using the builders of Business Path
'explanation' is the Order or Item or Document which is the
cause of a root applied rule in the simulation
"""
##############################################################################
#
# Copyright (c) 2009 Nexedi SA and Contributors. All Rights Reserved.
# Jean-Paul Smets-Solanes <jp@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from zope.interface import Interface
class IBusinessCompletable(Interface):
"""Business Completable interface specification
Business states and path can be completed or partially completed.
"""
def isCompleted(explanation):
"""True if all related simulation movements for this explanation
document are delivered and in simulation state which is considered
as finished.
"""
def isPartiallyCompleted(explanation):
"""True if some related simulation movements for this explanation
document are delivered and in simulation state which is considered
as finished.
"""
def getExpectedCompletionDate(task):
"""Returns the date at which the given state is expected to
be completed, based on the start_date and stop_date of
the given task document.
'task' is a document which follows the ITaskGetter interface
(getStartDate, getStopDate)
"""
def getExpectedCompletionDuration(task):
"""Returns the duration at which the the state
if expected to be completed, based on the start_date
and stop_date of the explanation document.
'task' is a document which follows the ITaskGetter interface
(getStartDate, getStopDate)
"""
def getRemainingTradePhaseList(explanation, trade_phase_list=None):
"""
Returns the list of remaining trade phase which to be done on the explanation.
trade_phase_list -- if provide, the result is filtered by it after collected
"""
##############################################################################
#
# Copyright (c) 2009 Nexedi SA and Contributors. All Rights Reserved.
# Jean-Paul Smets-Solanes <jp@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from Products.ERP5.Interface.IBusinessCompletable import IBusinessCompletable
from Products.ERP5.Interface.IBusinessBuildable import IBusinessBuildable
class IBusinessPath(IBusinessCompletable, IBusinessBuildable):
"""Business Path interface specification
"""
def getExpectedStartDate(task, predecessor_date=None):
"""Returns the expected start date for this
path based on the task and provided predecessor_date.
'task' is a document which follows the ITaskGetter interface
(getStartDate, getStopDate) and defined the reference dates
for the business process execution
'predecessor_date' can be provided as predecessor date and
to override the date provided in the task
"""
def getExpectedStopDate(task, predecessor_date=None):
"""Returns the expected stop date for this
path based on the task and provided predecessor_date.
'task' is a document which follows the ITaskGetter interface
(getStartDate, getStopDate) and defined the reference dates
for the business process execution
'predecessor_date' can be provided as predecessor date and
to override the date provided in the task
"""
##############################################################################
#
# Copyright (c) 2009 Nexedi SA and Contributors. All Rights Reserved.
# Jean-Paul Smets-Solanes <jp@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from Products.ERP5.Interface.IBusinessCompletable import IBusinessCompletable
from Products.ERP5.Interface.IBusinessBuildable import IBusinessBuildable
class IBusinessProcess(IBusinessCompletable, IBusinessBuildable):
"""Business Process interface specification
"""
def getBuildablePathValueList(explanation):
"""Returns the list of Business Path which are buildable
'explanation' is the Order or Item or Document which is the
cause of a root applied rule in the simulation
"""
def getCompletedStateValueList(explanation):
"""Returns the list of Business States which are completed
'explanation' is the Order or Item or Document which is the
cause of a root applied rule in the simulation
"""
def getPartiallyCompletedStateValueList(explanation):
"""Returns the list of Business States which are partially
completed
'explanation' is the Order or Item or Document which is the
cause of a root applied rule in the simulation
"""
def getLatestCompletedStateValue(explanation):
"""Returns a completed Business State with no succeeding
completed Business Path
'explanation' is the Order or Item or Document which is the
cause of a root applied rule in the simulation
"""
def getLatestPartiallyCompletedStateValue(explanation):
"""Returns a partially completed Business State with no
succeeding partially completed Business Path
'explanation' is the Order or Item or Document which is the
cause of a root applied rule in the simulation
"""
def getLatestCompletedStateValueList(explanation):
"""Returns all completed Business State with no succeeding
completed Business Path
'explanation' is the Order or Item or Document which is the
cause of a root applied rule in the simulation
"""
def getLatestPartiallyCompletedStateValueList(explanation):
"""Returns all partially completed Business State with no
succeeding partially completed Business Path
'explanation' is the Order or Item or Document which is the
cause of a root applied rule in the simulation
"""
def getTradePhaseList(self):
"""Returns list of all trade_phase of this Business Process
"""
##############################################################################
#
# Copyright (c) 2009 Nexedi SA and Contributors. All Rights Reserved.
# Jean-Paul Smets-Solanes <jp@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from Products.ERP5.Interface.IBusinessCompletable import IBusinessCompletable
class IBusinessState(IBusinessCompletable):
"""Business State interface specification
"""
##############################################################################
#
# Copyright (c) 2009 Nexedi SARL and Contributors. All Rights Reserved.
# Jean-Paul Smets-Solanes <jp@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from zope.interface import Interface
class IMovement(Interface):
"""Movement interface specification
A movement represents an amount of resources which
is moved along an Arrow (source and destination).
Equations:
Production/Consumption
(A -> B)
production_quantity means nothing
consumption_quantity means nothing
(A -> Nothing)
if quantity > 0
consumption_quantity = quantity
production_quantity = 0
if quantity < 0
consumption_quantity = 0
production_quantity = - quantity
(Nothing -> B)
if quantity > 0
consumption_quantity = 0
production_quantity = quantity
if quantity < 0
consumption_quantity = - quantity
production_quantity = 0
Credit/Debit
if quantity > 0
source_credit = - quantity
source_debit = quantity
destination_credit = quantity
destination_debit = - quantity
if quantity < 0
source_credit = quantity
source_debit = - quantity
destination_credit = - quantity
destination_debit = quantity
TODO:
1. finish equations (for asset price)
2. clarify asset value application for multi
currency accunting
3. clarify the use of asset price in ERP5
(accounting and outside) since we no
longer store asset price on non accounting
movements
"""
# Helper API for Production
def getConsumptionQuantity():
"""Returns the consumed quantity during
production
"""
def getProductionQuantity():
"""Returns the produced quantity during
production
"""
# Helper methods for asset value calculation
def getSourceAssetPrice():
"""Returns the asset price on the source, if defined
XXX - it is unclear if we still use this
"""
def getDestinationAssetPrice():
"""Returns the asset price on the destination, if defined
XXX - it is unclear if we still use this
"""
def getSourceInventoriatedTotalAssetPrice():
"""Returns the total asset price for the source, if defined
"""
def getDestinationInventoriatedTotalAssetPrice():
"""Returns the total asset price for the destination, if defined
"""
# Helper methods for single currency Accounting (debit / credit)
def getSourceDebit():
"""Returns the source debit in the transaction currency
"""
def getSourceCredit():
"""Returns the source credit in the transaction currency
"""
def getDestinationDebit():
"""Returns the destination debit in the transaction currency
"""
def getDestinationCredit():
"""Returns the destination credit in the transaction currency
"""
# Helper methods for multi currency Accounting (debit / credit)
def getSourceAssetDebit():
"""Returns the source debit in the source management currency
"""
def getSourceAssetCredit():
"""Returns the source credit in the source management currency
"""
def getDestinationAssetDebit():
"""Returns the destination debit in the destination management currency
"""
def getDestinationAssetCredit():
"""Returns the destination credit in the destination management currency
"""
def getSourceInventoriatedTotalAssetDebit():
"""Unclear - XXX
"""
def getSourceInventoriatedTotalAssetCredit():
"""Unclear - XXX
"""
def getDestinationInventoriatedTotalAssetDebit():
"""Unclear - XXX
"""
def getDestinationInventoriatedTotalAssetCredit():
"""Unclear - XXX
"""
\ No newline at end of file
##############################################################################
#
# Copyright (c) 2009 Nexedi SARL and Contributors. All Rights Reserved.
# Jean-Paul Smets-Solanes <jp@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from zope.interface import Interface
class ISimulationMovement(Interface):
"""Simulation Movement interface specification
The SimulationMovement interface introduces the option
to define quantity errors between the simulation
and the delivered reality.
In short: parent applied rules use the Movement
API to define quantity. Child applied rules
should use the Delivered API to access appropriate
quantity values which are take into account the
delivery_error.
DeliverySolver either solve divergence by
setting the delivery_error (then no target
solver needed, at least for quantity) or
by changing the quantity (then TargetSolver
is needed to backtrack the quantity).
Equation:
quantity(SM) + delivery_error (SM) =
quantity(DL) * delivery_ratio(SM)
TODO:
1. unclear API remaining
"""
# Delivery API
def getDeliveryRatio():
"""
Returns ratio to apply on the quantity
property of the corresponding delivery
to obtain the current quantity
"""
def getDeliveryError():
"""
Returns correction to make the match
between delivery quantity and simulation
quantity consistent
"""
def getDeliveryQuantity():
"""
Returns quantity which was actually shipped, taking
into account the errors of the simulation fixed by
the delivery
quantity + delivery_error
"""
def getDeliveryConvertedQuantity():
"""XXX - unclear
"""
# Divergence API
def isConvergent():
"""Tells whether the simulation movement is convergent
or not, with related delivery
"""
def isDivergent():
"""Tells whether the simulation movement is divergent
or not, with related delivery
"""
def getDivergenceList():
"""Returns a list of divergences
XXX - unclear, please explan what the returned documents
or object are (type, class)
"""
def isFrozen():
"""Tells whether the simulation movement is frozen.
By default, looks up the related Business Process Path
and tells if the simulation state is part of completed
states.
XXX - should this be renamed isCompleted ? are the
notions of isFrozen and isCompleted same or different ?
"""
def isSimulated():
"""XXX - unclear
"""
# -*- coding: utf8 -*-
##############################################################################
#
# Copyright (c) 2009 Nexedi SA and Contributors. All Rights Reserved.
# Jean-Paul Smets-Solanes <jp@nexedi.com>
# Łukasz Nowak <luke@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
# simple interface which have to be implemented on TradeModelLine,
# Transformation, Pay Sheet Model, etc
from zope.interface import Interface
class ITransformation(Interface):
"""
Common Interface to implementing quering of Indirect Amount
Models (TaxModelLine, InvoiceModelLine) shall be based on this interface
"""
def getAggregatedAmountList(context, **kw):
"""Returns implementation specific AggregatedAmountList of amounts
generated by set of rules
context - represents object for which calculation shall happen
**kw - contains implementations specific parameters
The method returns an instance of AggregatedAmountList class defined
at ERP5/AggregatedAmountList.py
Note: This method shall be linear in case if context is order, line,
applied rule or movement. In case of built delivery this method shall
be wise enough to CORRECTLY un-linearise calculation, eg. tax is
time dependent, paysheet build from invoices.
"""
pass
def updateAggregatedAmountList(context, **kw):
"""Updates currently existing movements on delivery
context - represents object on which update shall happen
**kw - contains implementations specific parameters
The method return a dict of list of movements : 'movement_to_add_list' and
'movement_to_delete_list'.
"""
pass
##############################################################################
#
# Copyright (c) 2009 Nexedi SA and Contributors. All Rights Reserved.
# Jean-Paul Smets-Solanes <jp@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from Interface import Interface
class OpenOrderExpander(Interface):
"""
Any class capable of expanding an Open Order Rule
follows the OpenOrderExpander interface
"""
def expandOpenOrderRule(applied_rule_id=None, force=0, **kw):
"""
This method is invoked by OpenOrderRule to delegate
the default implementation of expand
"""
##############################################################################
#
# Copyright (c) 2002 Nexedi SARL and Contributors. All Rights Reserved.
# Jean-Paul Smets-Solanes <jp@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from Interface import Interface
class Predicate(Interface):
"""
A Predicate allows to make a statement about a document.
A statement can be related to:
- the attributes of the document (ex. price >= 3.0)
- the categories of the document (ex. )
The Predicate class is an abstract class, which is
implemented by subclasses.
"""
def test(context, tested_base_category_list=None):
"""A Predicate can be tested on a given context.
Parameters can passed in order to ignore some conditions:
- tested_base_category_list: this is the list of category that we do
want to test. For example, we might want to test only the
destination or the source of a predicate.
"""
def asSQLExpression():
"""
A Predicate can be rendered as an sql expression. This
can be useful to create reporting trees based on the
ZSQLCatalog
"""
##############################################################################
#
# Copyright (c) 2002 Nexedi SARL and Contributors. All Rights Reserved.
# Jean-Paul Smets-Solanes <jp@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from Interface import Interface
class Rule(Interface):
"""A Rule describes transformations of documents.
"""
def constructNewAppliedRule(context):
"""Create a new applied rule in the context.
An applied rule is an instanciation of a Rule. The applied rule is
linked to the Rule through the `specialise` relation.
"""
def expand(applied_rule):
"""Expand this applied rule to create new documents inside the
applied rule.
"""
##############################################################################
#
# Copyright (c) 2002 Nexedi SARL and Contributors. All Rights Reserved.
# Jean-Paul Smets-Solanes <jp@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from Interface import Interface
class Variated(Interface):
"""
Common Interface for all objects which can be
variated.
"""
# The following methods are intended to access to the
# variation value of a variated object. Discrete variations
# are based on categories. General variations are encapsulated
# into VariationValue instances.
# Discrete Variation accessors
def getVariationCategoryList():
"""
returns a list or relative URLs which defines
a discrete variation (ie. a list of category
memberships)
"""
pass
def _setVariationCategoryList(node_list):
"""
modifies the discrete variation of an
variated instance by providing a list
of relative URLs
"""
pass
def setVariationCategoryList(node_list):
"""
modifies the discrete variation of an
variated instance by providing a list
of relative URLs
reindexes the object
"""
pass
def getVariationBaseCategoryList(node_list):
"""
returns a list of base category ids
which are used to define discrete variations
for this instance
"""
pass
def _setVariationBaseCategoryList(node_list):
"""
modifies the list of base category ids
which are used to define discrete variations
for this instance
"""
pass
def setVariationBaseCategoryList(node_list):
"""
modifies the list of base category ids
which are used to define discrete variations
for this instance
"""
pass
# General Variation accessors
def getVariationValue():
"""
Returns a VariationValue object.
"""
pass
def _setVariationValue(value):
"""
Private setter for VariationValue.
"""
pass
def setVariationValue(value):
"""
Sets the VariationValue.
"""
pass
# The following methods are intended to access the
# variation range of a variated object. A Variation range can
# be defined in a Resource instance or in any object
# which has a relation with a Resource (Amount, Transformation)
# Discrete Variation Range accessors
def getVariationRangeCategoryList(base_category_list=(), base=1):
"""
returns a list of categories which are acceptable
as discrete variation values
"""
pass
def getVariationRangeCategoryItemList(base_category_list=(),
display_id='getTitle', base=1, current_category=None):
"""
returns a list of (category.id, category.display_id()) which are acceptable
as discrete variation values
"""
pass
def getVariationRangeBaseCategoryList(base_category_list=(), base=1):
"""
returns a list of base categories which are acceptable
as discrete variation values
"""
pass
def getVariationRangeBaseCategoryItemList(base_category_list=(),
display_id='getTitle', base=1, current_category=None):
"""
returns a list of base category items which are acceptable
as discrete variation values
"""
pass
......@@ -85,3 +85,7 @@ class IBusinessProcess(IBusinessCompletable, IBusinessBuildable):
'explanation' is the Order or Item or Document which is the
cause of a root applied rule in the simulation
"""
def getTradePhaseList(self):
"""Returns list of all trade_phase of this Business Process
"""
##############################################################################
#
# Copyright (c) 2002-2009 Nexedi SA and Contributors. All Rights Reserved.
# Copyright (c) 2002 Nexedi SARL and Contributors. All Rights Reserved.
# Jean-Paul Smets-Solanes <jp@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
......@@ -37,12 +37,10 @@ class Rule(Interface):
An applied rule is an instanciation of a Rule. The applied rule is
linked to the Rule through the `specialise` relation.
XXX update params
"""
def expand(applied_rule):
"""Expand this applied rule to create new documents inside the
applied rule.
XXX update params
"""
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