Commit 35a8ba63 authored by Romain Courteaud's avatar Romain Courteaud

Call getAggregatedAmountList on a production order to test the composition

git-svn-id: https://svn.erp5.org/repos/public/erp5/sandbox/amount_generator@34790 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 4235e121
...@@ -66,6 +66,11 @@ class TestApparelTransformation(TestOrderMixin, ERP5TypeTestCase): ...@@ -66,6 +66,11 @@ class TestApparelTransformation(TestOrderMixin, ERP5TypeTestCase):
def getTitle(self): def getTitle(self):
return "Transformation" return "Transformation"
def getBusinessTemplateList(self):
"""
"""
return list(TestOrderMixin.getBusinessTemplateList(self)) + ['erp5_mrp']
def enableLightInstall(self): def enableLightInstall(self):
""" """
You can override this. You can override this.
...@@ -615,17 +620,20 @@ class TestApparelTransformation(TestOrderMixin, ERP5TypeTestCase): ...@@ -615,17 +620,20 @@ class TestApparelTransformation(TestOrderMixin, ERP5TypeTestCase):
""" """
Verify aggregated data according to an expected structure Verify aggregated data according to an expected structure
""" """
from Products.ERP5Type.Document import newTempAmount
produced_resource = transformation.getResource() produced_resource = transformation.getResource()
production_order_module = self.portal.getDefaultModule("Production Order")
production_order = production_order_module.newContent(
portal_type="Production Order")
for i, expected in enumerate(expected_list): for i, expected in enumerate(expected_list):
context = newTempAmount(transformation, "temp_amount_%s" % i) context = production_order.newContent(
portal_type="Production Order Line")
context.edit( context.edit(
quantity = 1.0, quantity = 1.0,
variation_category_list = expected['id'], variation_category_list = expected['id'],
resource = produced_resource, resource = produced_resource,
specialise=transformation.getRelativeUrl(),
) )
aggregated_amount_list = transformation.getAggregatedAmountList(context) aggregated_amount_list = production_order.getAggregatedAmountList([context])
expected_amount_list = expected['amount'] expected_amount_list = expected['amount']
expected_amount_list_len = len(expected_amount_list) expected_amount_list_len = len(expected_amount_list)
......
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