Commit f18ad53b authored by Jean-Paul Smets's avatar Jean-Paul Smets

renamed transformation interface

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@30608 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 00657d70
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2002 Nexedi SARL and Contributors. All Rights Reserved.
......@@ -26,6 +27,8 @@
#
##############################################################################
import zope.interface
from AccessControl import ClassSecurityInfo
from Products.CMFCore.utils import getToolByName
from Products.ERP5Type import Permissions, PropertySheet, Constraint, interfaces
......@@ -74,6 +77,9 @@ class AppliedRule(XMLObject):
, PropertySheet.AppliedRule
)
# Declarative interfaces
zope.interface.implements(interfaces.IMovementCollection,)
def tpValues(self) :
""" show the content in the left pane of the ZMI """
return self.objectValues()
......
......@@ -76,7 +76,9 @@ class TradeCondition(Path, Transformation, XMLMatrix):
, PropertySheet.Order
)
zope.interface.implements(interfaces.ITransformation)
zope.interface.implements(interfaces.IAmountGenerator,
interfaces.IMovementGenerator,
interfaces.IMovementCollectionUpdater,)
security.declareProtected(Permissions.AccessContentsInformation,
'updateAggregatedAmountList')
......
......@@ -50,7 +50,7 @@ class TradeModelCell(TradeModelLine, MappedValue):
# Declarative interfaces
# interfaces.IVariated as soon as interfaces.IVariated will be zope3
zope.interface.implements(
interfaces.ITransformation
interfaces.IAmountGenerator
)
# Declarative properties
......
......@@ -56,7 +56,7 @@ class TradeModelLine(Predicate, XMLMatrix, Amount):
# Declarative interfaces
zope.interface.implements(
interfaces.ITransformation,
interfaces.IAmountGenerator,
interfaces.IVariated
)
......
......@@ -83,7 +83,7 @@ class Transformation(XMLObject, Predicate, Variated):
# Declarative interfaces
zope.interface.implements(interfaces.IVariated,
interfaces.ITransformation
interfaces.IAmountGenerator
)
......
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2002, 2004 Nexedi SARL and Contributors. All Rights Reserved.
......@@ -78,7 +79,7 @@ class TransformedResource(Predicate, XMLObject, XMLMatrix, Amount):
)
# Declarative interfaces
zope.interface.implements( interfaces.ITransformation )
zope.interface.implements(interfaces.IAmountGenerator,)
### Variation matrix definition
#
......
......@@ -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
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.
"""
Returns an IAmountList generated by a model a model applied to the
context.
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
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
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.
NOTE:
- implement rounding appropriately (True or False seems
simplistic)
"""
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