Commit feb60a37 authored by Julien Muchembled's avatar Julien Muchembled

amount_generator: AggregatedAmountList -> GeneratedAmountList

parent 1abc4bac
...@@ -39,7 +39,7 @@ from Products.ERP5Type import Permissions, PropertySheet, interfaces ...@@ -39,7 +39,7 @@ from Products.ERP5Type import Permissions, PropertySheet, interfaces
from Products.ERP5Type.Utils import deprecated from Products.ERP5Type.Utils import deprecated
from Products.ERP5.mixin.composition import _getEffectiveModel from Products.ERP5.mixin.composition import _getEffectiveModel
from Products.ERP5.Document.Transformation import Transformation from Products.ERP5.Document.Transformation import Transformation
from Products.ERP5.AggregatedAmountList import AggregatedAmountList from Products.ERP5.GeneratedAmountList import GeneratedAmountList
from Products.ERP5.Document.MappedValue import MappedValue from Products.ERP5.Document.MappedValue import MappedValue
from Products.ERP5.mixin.amount_generator import AmountGeneratorMixin from Products.ERP5.mixin.amount_generator import AmountGeneratorMixin
from Products.ERP5.mixin.variated import VariatedMixin from Products.ERP5.mixin.variated import VariatedMixin
......
...@@ -31,7 +31,7 @@ import zope.interface ...@@ -31,7 +31,7 @@ import zope.interface
from AccessControl import allow_class from AccessControl import allow_class
from Products.ERP5Type import interfaces from Products.ERP5Type import interfaces
class AggregatedAmountList(list): class GeneratedAmountList(list):
""" """
Temporary object needed to aggregate Amount value Temporary object needed to aggregate Amount value
And to calculate some report or total value And to calculate some report or total value
...@@ -60,4 +60,4 @@ class AggregatedAmountList(list): ...@@ -60,4 +60,4 @@ class AggregatedAmountList(list):
result += duration result += duration
return result return result
allow_class(AggregatedAmountList) allow_class(GeneratedAmountList)
...@@ -32,7 +32,7 @@ import zope.interface ...@@ -32,7 +32,7 @@ import zope.interface
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.ERP5Type.Globals import InitializeClass from Products.ERP5Type.Globals import InitializeClass
from Acquisition import aq_base, Implicit from Acquisition import aq_base, Implicit
from Products.ERP5.AggregatedAmountList import AggregatedAmountList from Products.ERP5.GeneratedAmountList import GeneratedAmountList
from Products.ERP5Type import Permissions, interfaces from Products.ERP5Type import Permissions, interfaces
from Products.ERP5Type.TransactionalVariable import getTransactionalVariable from Products.ERP5Type.TransactionalVariable import getTransactionalVariable
from Products.ERP5.Document.MappedValue import MappedValue from Products.ERP5.Document.MappedValue import MappedValue
...@@ -281,7 +281,7 @@ class AmountGeneratorMixin: ...@@ -281,7 +281,7 @@ class AmountGeneratorMixin:
portal.getPortalAmountGeneratorCellTypeList() portal.getPortalAmountGeneratorCellTypeList()
# Set empty result by default # Set empty result by default
result = AggregatedAmountList() result = GeneratedAmountList()
args = (getTransactionalVariable().setdefault( args = (getTransactionalVariable().setdefault(
"amount_generator.BaseAmountDict", {}), "amount_generator.BaseAmountDict", {}),
...@@ -517,7 +517,7 @@ class AmountGeneratorMixin: ...@@ -517,7 +517,7 @@ class AmountGeneratorMixin:
# XXX: Do we handle rounding correctly ? # XXX: Do we handle rounding correctly ?
# What to do if only total price is rounded ?? # What to do if only total price is rounded ??
aggregate_dict = {} aggregate_dict = {}
result_list = AggregatedAmountList() result_list = GeneratedAmountList()
for amount in generated_amount_list: for amount in generated_amount_list:
key = (amount.getPrice(), amount.getEfficiency(), key = (amount.getPrice(), amount.getEfficiency(),
amount.getReference(), amount.categories) amount.getReference(), amount.categories)
......
...@@ -529,7 +529,7 @@ class TestApparelTransformation(TestOrderMixin, ERP5TypeTestCase): ...@@ -529,7 +529,7 @@ class TestApparelTransformation(TestOrderMixin, ERP5TypeTestCase):
def stepVerifySpecialisedTransformationAggregatedAmountList(self, sequence=None, sequence_list=None, **kw): def stepVerifySpecialisedTransformationAggregatedAmountList(self, sequence=None, sequence_list=None, **kw):
""" """
Verify the return of AggregatedAmountList for a transformation which includes another one Verify the return of GeneratedAmountList for a transformation which includes another one
""" """
expected_list = [ expected_list = [
{'id':('size/Baby', 'colour/apparel_model_module/1/1', 'morphology/apparel_model_module/1/4'), {'id':('size/Baby', 'colour/apparel_model_module/1/1', 'morphology/apparel_model_module/1/4'),
...@@ -672,7 +672,7 @@ class TestApparelTransformation(TestOrderMixin, ERP5TypeTestCase): ...@@ -672,7 +672,7 @@ class TestApparelTransformation(TestOrderMixin, ERP5TypeTestCase):
# Check global quantity # Check global quantity
total_price = aggregated_amount_list.getTotalPrice() total_price = aggregated_amount_list.getTotalPrice()
error_msg = 'Total price for AggregatedAmountList differs between ' \ error_msg = 'Total price for GeneratedAmountList differs between ' \
'expected (%s) and aggregated (%s) (%s)' % \ 'expected (%s) and aggregated (%s) (%s)' % \
(total_price, expected['total'], expected['id']) (total_price, expected['total'], expected['id'])
self.assertEqual(round(total_price, 10), round(expected['total'], 10), self.assertEqual(round(total_price, 10), round(expected['total'], 10),
......
...@@ -55,7 +55,7 @@ implements_tuple_list = [ ...@@ -55,7 +55,7 @@ implements_tuple_list = [
(('Products.ERP5.Document.EmailDocument', 'EmailDocument'), 'IDocument'), (('Products.ERP5.Document.EmailDocument', 'EmailDocument'), 'IDocument'),
(('Products.ERP5.Document.Event', 'Event'), 'IDocument'), (('Products.ERP5.Document.Event', 'Event'), 'IDocument'),
# IAmountList # IAmountList
(('Products.ERP5.AggregatedAmountList', 'AggregatedAmountList'), 'IAmountList'), (('Products.ERP5.GeneratedAmountList', 'GeneratedAmountList'), 'IAmountList'),
] ]
# IMovementGroup # IMovementGroup
for movement_group_class_name in ['MovementGroup', 'BaseVariantMovementGroup', for movement_group_class_name in ['MovementGroup', 'BaseVariantMovementGroup',
......
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