[Erp5-report] r26605 - /erp5/trunk/products/ERP5/Interface/
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Apr 23 11:04:56 CEST 2009
Author: jp
Date: Thu Apr 23 11:04:55 2009
New Revision: 26605
URL: http://svn.erp5.org?rev=26605&view=rev
Log:
First review by JPS.
Modified:
erp5/trunk/products/ERP5/Interface/IAmount.py
erp5/trunk/products/ERP5/Interface/IMovement.py
erp5/trunk/products/ERP5/Interface/ISimulationMovement.py
Modified: erp5/trunk/products/ERP5/Interface/IAmount.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Interface/IAmount.py?rev=26605&r1=26604&r2=26605&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Interface/IAmount.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Interface/IAmount.py [utf8] Thu Apr 23 11:04:55 2009
@@ -26,15 +26,16 @@
#
##############################################################################
-from Interface import Interface
+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
- or (exclusive) profit/loss quantity can be specified
- in order to represent a profit or loss ratio to take
- into account in calculations.
+ 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
@@ -45,11 +46,15 @@
net_quantity = quantity * efficiency
TODO:
- consider how to make Interface compatible
- with accessor generation (ex. getResource)
-
- Addition:
- target_quantity is obsolete, it is never defined.
+ 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
@@ -74,7 +79,7 @@
def isCancellationAmount():
"""
A cancellation amount must be interpreted
- reversely write to the sign of qauntity.
+ reversely wrt. to the sign of quantity.
For example, a negative credit for a cancellation
amount is a negative credit, not a positive
@@ -88,67 +93,62 @@
# Net Quantity API
def getEfficiency():
"""
- Returns a value which is rate affect to the net quantity
- Only used for transformation for now.
+ 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 affected quantity by some optional effects.
+ Returns the quantity multiplied by the ratio.
"""
# Price API
-
def getPrice():
"""
- Returns price
+ Returns the unit price of the resource
"""
def getTotalPrice():
"""
- Returns total price for the number of items
+ Returns total price ie. the unit price of the resource
+ multiplied by the quantity.
"""
# Conversion API
def getConvertedQuantity():
"""
- Returns the quantity converted by the resource
+ Returns the quantity of the resource converted in the
+ management unit of the resource
"""
def getNetConvertedQuantity():
"""
- Returns the net quantity converted by the resource
+ 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
+ """Add an amount to another amount
- If the amount can understands argument as amount for addition,
- returns calculated
+ 'value' is an IAmount document
"""
def __sub__(value):
- """
- Substract
+ """Substract an amount from another amount
- If the amount can understands argument as amount for substraction,
- returns calculated
+ 'value' is an IAmount document
"""
def __mul__(value):
- """
- Multiply
+ """Multiply an Amount by a float
- If the amount can understands argument as efficiency for multiplication,
- returns calculated
+ 'value' is a float
"""
def __div__(value):
+ """Divide an Amount by a float
+
+ 'value' is a float
"""
- Devide
-
- If the amount can understands argument as efficiency for division,
- returns calculated
- """
Modified: erp5/trunk/products/ERP5/Interface/IMovement.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Interface/IMovement.py?rev=26605&r1=26604&r2=26605&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Interface/IMovement.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Interface/IMovement.py [utf8] Thu Apr 23 11:04:55 2009
@@ -26,228 +26,138 @@
#
##############################################################################
-from Interface import Interface
+from zope.interface import Interface
class IMovement(Interface):
- """
- A movement represents amount of resource how are changed
- on the path. The movement should be ables to provide how
- amount is/was existed on node both source and destination.
- Because of movement may be affected on path.
+ """Movement interface specification
- The movement interface can be represents any kind of delivery.
- It is useful to represent changed of between nodes.
+ A movement represents an amount of resources which
+ is moved along an Arrow (source and destination).
Equations:
- destination_quantity = source_quantity * efficiency
- (These values can be calculated by Amount)
-
-
Production/Consumption
(A -> B)
- if source_quantity > 0 and destination_quantity > 0
- production_quantity = destination_quantity
- consumption_quantity = source_quantity
-
- if source_quantity < 0 and destination_quantity < 0
- production_quantity = - source_quantity
- consumption_quantity = - destination_quantity
-
- if source_quantity < 0 and destination_quantity > 0
- or
- source_quantity > 0 and destination_quantity < 0
- raise
-
+ production_quantity means nothing
+ consumption_quantity means nothing
(A -> Nothing)
- if source_quantity > 0
- consumption_quantity = source_quantity
- production_quantity = 0
+ if quantity > 0
+ consumption_quantity = quantity
+ production_quantity = 0
- if source_quantity < 0
- consumption_quantity = 0
- production_quantity = - source_quantity
+ if quantity < 0
+ consumption_quantity = 0
+ production_quantity = - quantity
(Nothing -> B)
- if destination_quantity > 0
- consumption_quantity = 0
- production_quantity = destination_quantity
+ if quantity > 0
+ consumption_quantity = 0
+ production_quantity = quantity
- if destination_quantity < 0
- consumption_quantity = - destination_quantity
- production_quantity = 0
-
+ if quantity < 0
+ consumption_quantity = - quantity
+ production_quantity = 0
Credit/Debit
- (A -> B)
- if source_quantity > 0 and destination_quantity > 0
- source_credit = - source_quantity
- source_debit = source_quantity
- destination_credit = destination_quantity
- destination_debit = - destination_quantity
+ if quantity > 0
+ source_credit = - quantity
+ source_debit = quantity
+ destination_credit = quantity
+ destination_debit = - quantity
- if source_quantity < 0 and destination_quantity < 0
- source_credit = source_quantity
- source_debit = - source_quantity
- destination_credit = - destination_quantity
- destination_debit = destination_quantity
+ if quantity < 0
+ source_credit = quantity
+ source_debit = - quantity
+ destination_credit = - quantity
+ destination_debit = quantity
- if source_quantity < 0 and destination_quantity > 0
- or
- source_quantity > 0 and destination_quantity < 0
- raise
-
- (A -> Nothing)
- if source_quantity > 0
- source_credit = source_quantity
- source_debit = - source_quantity
- destination_credit = 0
- destination_debit = 0
-
- if source_quantity < 0
- source_credit = - source_quantity
- source_debit = source_quantity
- destination_credit = 0
- destination_debit = 0
-
- (Nothing -> B)
- if destination_quantity > 0
- source_credit = 0
- source_debit = 0
- destination_credit = destination_quantity
- destination_debit = - destination_quantity
-
- if destination_quantity < 0
- source_credit = 0
- source_debit = 0
- destination_credit = - destination_quantity
- destination_debit = destination_quantity
-
- source_asset_price = price
- destination_asset_price = price
+ 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
"""
-
- # Conversion API for cataloging
- def getConvertedSourceQuantity():
- """
- Returns the quantity how are removed
- from source by the movement
- """
-
- def getConvertedDestinationQuantity():
- """
- Returns the quantity how are reached
- to destination by the movement
- """
-
- # Helper methods for Production
+ # Helper API for Production
def getConsumptionQuantity():
- """
- Returns the quantity how are consumed
- on the path by the movement
+ """Returns the consumed quantity during
+ production
"""
def getProductionQuantity():
- """
- Returns the quantity how are produced
- on the path by the movement
+ """Returns the produced quantity during
+ production
"""
- # Helper methods for Accounting
+ # 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 quantity how are debited
- from source node by the movement
+ """Returns the source debit in the transaction currency
"""
def getSourceCredit():
- """
- Returns the quantity how are credited
- from source node by the movement
+ """Returns the source credit in the transaction currency
"""
def getDestinationDebit():
- """
- Returns the quantity how are debited
- to destination node by the movement
+ """Returns the destination debit in the transaction currency
"""
def getDestinationCredit():
- """
- Returns the quantity how are credited
- to destination node by the movement
+ """Returns the destination credit in the transaction currency
"""
- def getSourceAssetPrice():
- """
- Returns the price how are taken
- from source by the movement
+ # Helper methods for multi currency Accounting (debit / credit)
+ def getSourceAssetDebit():
+ """Returns the source debit in the source management currency
"""
- def getSourceInventoriatedTotalAssetPrice():
+ def getSourceAssetCredit():
+ """Returns the source credit in the source management currency
"""
- Returns a price which can be used
- to calculate stock value (asset)
+
+ def getDestinationAssetDebit():
+ """Returns the destination debit in the destination management currency
+ """
+
+ def getDestinationAssetCredit():
+ """Returns the destination credit in the destination management currency
"""
def getSourceInventoriatedTotalAssetDebit():
- """
- Returns the debit part of inventoriated
- source total asset price.
+ """Unclear - XXX
"""
def getSourceInventoriatedTotalAssetCredit():
- """
- Returns the credit part of inventoriated
- source total asset price.
- """
-
- def getSourceAssetDebit():
- """
- Return the debit part of the source total
- asset price.
- """
-
- def getSourceAssetCredit():
- """
- Return the credit part of the source total
- asset price.
- """
-
- def getDestinationAssetPrice():
- """
- Returns the price how are given
- to destination by the movement
- """
-
- def getDestinationInventoriatedTotalAssetPrice():
- """
- Returns a price which can be used
- to calculate stock value (asset)
+ """Unclear - XXX
"""
def getDestinationInventoriatedTotalAssetDebit():
- """
- Returns the debit part of inventoriated
- destination total asset price.
+ """Unclear - XXX
"""
def getDestinationInventoriatedTotalAssetCredit():
- """
- Returns the credit part of inventoriated
- destination total asset price.
- """
-
- def getDestinationAssetDebit():
- """
- Return the debit part of the destination total
- asset price.
- """
-
- def getDestinationAssetCredit():
- """
- Return the credit part of the destination total
- asset price.
- """
+ """Unclear - XXX
+ """
Modified: erp5/trunk/products/ERP5/Interface/ISimulationMovement.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Interface/ISimulationMovement.py?rev=26605&r1=26604&r2=26605&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Interface/ISimulationMovement.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Interface/ISimulationMovement.py [utf8] Thu Apr 23 11:04:55 2009
@@ -26,21 +26,20 @@
#
##############################################################################
-from Interface import Interface
+from zope.interface import Interface
class ISimulationMovement(Interface):
- """
- The SimulationMovement interface
- introduces the possibility to define
- quantity errors between the simulation
- and the reality.
+ """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 use the Delivered API
- to use appropriate values which include
- the delivery_error.
+ 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
@@ -48,9 +47,13 @@
by changing the quantity (then TargetSolver
is needed to backtrack the quantity).
- quantity(SM) + delivery_error (SM) =
- quantity(DL) * delivery_ratio(SM)
- """
+ Equation:
+ quantity(SM) + delivery_error (SM) =
+ quantity(DL) * delivery_ratio(SM)
+
+ TODO:
+ 1. unclear API remaining
+ """
# Delivery API
def getDeliveryRatio():
@@ -69,50 +72,45 @@
def getDeliveryQuantity():
"""
- Returns quantity which was actually
- shipped, taking into account the errors
- of the simulation fixed by the delivery
+ Returns quantity which was actually shipped, taking
+ into account the errors of the simulation fixed by
+ the delivery
quantity + delivery_error
"""
def getDeliveryConvertedQuantity():
- """
- Returns delivery quantity converted by the resource
+ """XXX - unclear
"""
# Divergence API
def isConvergent():
- """
- Returns the simulation movement is convergent
- or not, with related the delivery
+ """Tells whether the simulation movement is convergent
+ or not, with related delivery
"""
def isDivergent():
- """
- Returns the simulation movement is divergent
- or not, to related the delivery
+ """Tells whether the simulation movement is divergent
+ or not, with related delivery
"""
def getDivergenceList():
- """
- Returns listed divergences which is made by tester
- of parent applied rule
- Each divergence has why the delivery was judged
+ """Returns a list of divergences
+ XXX - unclear, please explan what the returned documents
+ or object are (type, class)
"""
def isFrozen():
- """
- Returns status of the simulation movement, it is
- frozen or not, once it is frozen, all operations
- can not change anything of the simulation movement
+ """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():
- """
- Returns the simulation movement is simulated or not
- When the simulation movement is simulated, all operations
- can not remove it, but can update, because related delivery
- to be orphan, if can remove it
+ """XXX - unclear
"""
More information about the Erp5-report
mailing list