[Erp5-report] r30608 - in /erp5/trunk/products/ERP5: Document/ interfaces/

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Nov 13 23:25:06 CET 2009


Author: jp
Date: Fri Nov 13 23:25:05 2009
New Revision: 30608

URL: http://svn.erp5.org?rev=30608&view=rev
Log:
renamed transformation interface

Added:
    erp5/trunk/products/ERP5/interfaces/amount_generator.py
      - copied, changed from r30517, erp5/trunk/products/ERP5/interfaces/transformation.py
Removed:
    erp5/trunk/products/ERP5/interfaces/transformation.py
Modified:
    erp5/trunk/products/ERP5/Document/AppliedRule.py
    erp5/trunk/products/ERP5/Document/TradeCondition.py
    erp5/trunk/products/ERP5/Document/TradeModelCell.py
    erp5/trunk/products/ERP5/Document/TradeModelLine.py
    erp5/trunk/products/ERP5/Document/Transformation.py
    erp5/trunk/products/ERP5/Document/TransformedResource.py

Modified: erp5/trunk/products/ERP5/Document/AppliedRule.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/AppliedRule.py?rev=30608&r1=30607&r2=30608&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/AppliedRule.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/AppliedRule.py [utf8] Fri Nov 13 23:25:05 2009
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 ##############################################################################
 #
 # Copyright (c) 2002 Nexedi SARL and Contributors. All Rights Reserved.
@@ -25,6 +26,8 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #
 ##############################################################################
+
+import zope.interface
 
 from AccessControl import ClassSecurityInfo
 from Products.CMFCore.utils import getToolByName
@@ -73,6 +76,9 @@
                       , PropertySheet.CategoryCore
                       , PropertySheet.AppliedRule
                       )
+
+    # Declarative interfaces
+    zope.interface.implements(interfaces.IMovementCollection,)
 
     def tpValues(self) :
       """ show the content in the left pane of the ZMI """

Modified: erp5/trunk/products/ERP5/Document/TradeCondition.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/TradeCondition.py?rev=30608&r1=30607&r2=30608&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/TradeCondition.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/TradeCondition.py [utf8] Fri Nov 13 23:25:05 2009
@@ -76,7 +76,9 @@
                       , PropertySheet.Order
                       )
 
-    zope.interface.implements(interfaces.ITransformation)
+    zope.interface.implements(interfaces.IAmountGenerator,
+                              interfaces.IMovementGenerator,
+                              interfaces.IMovementCollectionUpdater,)
 
     security.declareProtected(Permissions.AccessContentsInformation,
                               'updateAggregatedAmountList')

Modified: erp5/trunk/products/ERP5/Document/TradeModelCell.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/TradeModelCell.py?rev=30608&r1=30607&r2=30608&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/TradeModelCell.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/TradeModelCell.py [utf8] Fri Nov 13 23:25:05 2009
@@ -50,7 +50,7 @@
     # Declarative interfaces
     #    interfaces.IVariated as soon as interfaces.IVariated will be zope3
     zope.interface.implements(
-        interfaces.ITransformation
+        interfaces.IAmountGenerator
     )
 
     # Declarative properties

Modified: erp5/trunk/products/ERP5/Document/TradeModelLine.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/TradeModelLine.py?rev=30608&r1=30607&r2=30608&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/TradeModelLine.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/TradeModelLine.py [utf8] Fri Nov 13 23:25:05 2009
@@ -56,7 +56,7 @@
 
   # Declarative interfaces
   zope.interface.implements(
-      interfaces.ITransformation,
+      interfaces.IAmountGenerator,
       interfaces.IVariated
   )
 

Modified: erp5/trunk/products/ERP5/Document/Transformation.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/Transformation.py?rev=30608&r1=30607&r2=30608&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/Transformation.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/Transformation.py [utf8] Fri Nov 13 23:25:05 2009
@@ -83,7 +83,7 @@
 
     # Declarative interfaces
     zope.interface.implements(interfaces.IVariated, 
-                              interfaces.ITransformation
+                              interfaces.IAmountGenerator
                               )
 
 

Modified: erp5/trunk/products/ERP5/Document/TransformedResource.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/TransformedResource.py?rev=30608&r1=30607&r2=30608&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/TransformedResource.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/TransformedResource.py [utf8] Fri Nov 13 23:25:05 2009
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 ##############################################################################
 #
 # Copyright (c) 2002, 2004 Nexedi SARL and Contributors. All Rights Reserved.
@@ -78,7 +79,7 @@
                       )
 
     # Declarative interfaces
-    zope.interface.implements( interfaces.ITransformation )
+    zope.interface.implements(interfaces.IAmountGenerator,)
 
     ### Variation matrix definition
     #

Copied: erp5/trunk/products/ERP5/interfaces/amount_generator.py (from r30517, erp5/trunk/products/ERP5/interfaces/transformation.py)
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/interfaces/amount_generator.py?p2=erp5/trunk/products/ERP5/interfaces/amount_generator.py&p1=erp5/trunk/products/ERP5/interfaces/transformation.py&r1=30517&r2=30608&rev=30608&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/interfaces/transformation.py [utf8] (original)
+++ erp5/trunk/products/ERP5/interfaces/amount_generator.py [utf8] Fri Nov 13 23:25:05 2009
@@ -28,53 +28,35 @@
 #
 ##############################################################################
 """
-Products.ERP5.interfaces.simulation_movement
 """
 
 from zope.interface import Interface
-from zope.schema.interfaces import ISequence
 
-class ITransformation(Interface):
-  """
-    Common Interface to implementing querying of indirect amount
-    models (TaxModelLine, InvoiceModelLine, etc) shall be based on this
-    interface
+class IAmountGenerator(Interface):
+  """Amount Generator interface specification
+  
+  Documents which implement IAmountGenerator
+  can be used to generate an IAmountList from
+  an existing IMovementCollection, IAmountList or
+  IAmount. Typical IMovementGenerator are Transformations
+  and Trade Conditions.
   """
 
   def getAggregatedAmountList(context, movement_list=None, rounding=False):
-    """Returns list of amounts generated by set of models
+    """
+    Returns an IAmountList generated by a model a model applied to the
+    context.
 
-    context - represents object on which calculation shall happen
+    context - an IMovementCollection, an IAmountList or an IAmount
 
-    movement_list - optional argument, movement list to apply on, if not passed
-      it will be generated from passed context
+    movement_list - optional IAmountList which can be passed explicitely
+                    whenever context is an IMovementCollection and whenever
+                    we want to filter context.geMovementList
 
     rounding - boolean argument, which controls if rounding shall be applied on
-      generated movements or not
+               generated movements or not
 
-    Returns an instance implementing IAggregatedAmountList.
-
-    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.
+    NOTE:
+      - implement rounding appropriately (True or False seems 
+        simplistic)
     """
-
-  def updateAggregatedAmountList(context, movement_list=None, rounding=False):
-    """Updates existing movements and returns new or deleted if any according to model
-
-    context - represents object on which update shall happen
-
-    movement_list - optional argument, movement list to apply on, if not passed
-      it will be generated from passed context
-
-    rounding - boolean argument, which controls if rounding shall be applied on
-      generated movements or not
-
-    Returns a dictionary with two keys:
-      * movement_to_add_list - an instance of IAggregatedAmountList for amounts
-        that have to be added in the context.
-        FIXME: this is not 'movement'
-      * movement_to_delete_list - a list of movements from movement_list or from the
-        context that shall be deleted.
-    """

Removed: erp5/trunk/products/ERP5/interfaces/transformation.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/interfaces/transformation.py?rev=30607&view=auto
==============================================================================
--- erp5/trunk/products/ERP5/interfaces/transformation.py [utf8] (original)
+++ erp5/trunk/products/ERP5/interfaces/transformation.py (removed)
@@ -1,80 +1,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# Copyright (c) 2009 Nexedi SA and Contributors. All Rights Reserved.
-#                    Jean-Paul Smets-Solanes <jp at nexedi.com>
-#                    Łukasz Nowak <luke at nexedi.com>
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsibility 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
-# guarantees and support are strongly advised 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.
-#
-##############################################################################
-"""
-Products.ERP5.interfaces.simulation_movement
-"""
-
-from zope.interface import Interface
-from zope.schema.interfaces import ISequence
-
-class ITransformation(Interface):
-  """
-    Common Interface to implementing querying of indirect amount
-    models (TaxModelLine, InvoiceModelLine, etc) shall be based on this
-    interface
-  """
-
-  def getAggregatedAmountList(context, movement_list=None, rounding=False):
-    """Returns list of amounts generated by set of models
-
-    context - represents object on which calculation shall happen
-
-    movement_list - optional argument, movement list to apply on, if not passed
-      it will be generated from passed context
-
-    rounding - boolean argument, which controls if rounding shall be applied on
-      generated movements or not
-
-    Returns an instance implementing IAggregatedAmountList.
-
-    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.
-    """
-
-  def updateAggregatedAmountList(context, movement_list=None, rounding=False):
-    """Updates existing movements and returns new or deleted if any according to model
-
-    context - represents object on which update shall happen
-
-    movement_list - optional argument, movement list to apply on, if not passed
-      it will be generated from passed context
-
-    rounding - boolean argument, which controls if rounding shall be applied on
-      generated movements or not
-
-    Returns a dictionary with two keys:
-      * movement_to_add_list - an instance of IAggregatedAmountList for amounts
-        that have to be added in the context.
-        FIXME: this is not 'movement'
-      * movement_to_delete_list - a list of movements from movement_list or from the
-        context that shall be deleted.
-    """




More information about the Erp5-report mailing list