Commit 6f8fe0b4 authored by Jérome Perrin's avatar Jérome Perrin

test for Folder_generateWorkflowReport on Sale Orders


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@23160 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 24773216
...@@ -161,6 +161,8 @@ class TestTradeReports(ERP5ReportTestCase): ...@@ -161,6 +161,8 @@ class TestTradeReports(ERP5ReportTestCase):
[x for x in self.portal_categories['colour'].objectIds()]) [x for x in self.portal_categories['colour'].objectIds()])
self.inventory_module.manage_delObjects( self.inventory_module.manage_delObjects(
list(self.inventory_module.objectIds())) list(self.inventory_module.objectIds()))
self.sale_order_module.manage_delObjects(
list(self.sale_order_module.objectIds()))
get_transaction().commit() get_transaction().commit()
self.tic() self.tic()
...@@ -612,6 +614,77 @@ class TestTradeReports(ERP5ReportTestCase): ...@@ -612,6 +614,77 @@ class TestTradeReports(ERP5ReportTestCase):
inventory=66, inventory=66,
quantity_unit='') quantity_unit='')
def test_Folder_generateWorkflowReport(self):
# Create sales orders
first = self._makeOneSaleOrder(
title='SO 1',
destination_value=self.organisation_module.Organisation_1,
destination_section_value=self.organisation_module.Organisation_1,
destination_decision_value=self.organisation_module.Organisation_1,
source_value=self.organisation_module.Organisation_2,
source_section_value=self.organisation_module.Organisation_2,
source_decision_value=self.organisation_module.Organisation_2,
start_date=DateTime(2006, 2, 2),
resource_dict = {'product_module/product_A':{"quantity":11, "price":3},
'product_module/product_B':{"quantity":7, "price":6},}
)
second = self._makeOneSaleOrder(
title='SO 2',
destination_value=self.organisation_module.Organisation_1,
destination_section_value=self.organisation_module.Organisation_1,
destination_decision_value=self.organisation_module.Organisation_1,
source_value=self.organisation_module.Organisation_2,
source_section_value=self.organisation_module.Organisation_2,
source_decision_value=self.organisation_module.Organisation_2,
start_date=DateTime(2007, 2, 2),
resource_dict = {'product_module/product_A':{"quantity":3, "price":3},}
)
third = self._makeOneSaleOrder(
title='SO 4',
destination_value=self.organisation_module.Organisation_1,
destination_section_value=self.organisation_module.Organisation_1,
destination_decision_value=self.organisation_module.Organisation_1,
source_value=self.organisation_module.Organisation_2,
source_section_value=self.organisation_module.Organisation_2,
source_decision_value=self.organisation_module.Organisation_2,
start_date=DateTime(2007, 2, 2),
resource_dict = {'product_module/product_A':{"quantity":17, "price":3},
'product_module/product_B':{"quantity":13, "price":6},},
cancel=True
)
# call the report first, it will set selection
report_html = \
self.portal.sale_order_module.Folder_generateWorkflowReport()
self.failIf('Site Error' in report_html)
line_list = self.portal.sale_order_module.Folder_viewWorkflowReport.listbox.\
get_value('default',
render_format='list', REQUEST=self.portal.REQUEST)
data_line_list = [l for l in line_list if l.isDataLine()]
self.assertEquals(6, len(data_line_list))
self.checkLineProperties(data_line_list[0],
translated_portal_type='Sale Order')
self.checkLineProperties(data_line_list[1],
translated_portal_type='',
state='Cancelled',
count=1)
self.checkLineProperties(data_line_list[2],
translated_portal_type='',
state='Draft',
count=2)
self.checkLineProperties(data_line_list[3],
translated_portal_type='All')
self.checkLineProperties(data_line_list[4],
translated_portal_type='',
state='Cancelled',
count=1)
self.checkLineProperties(data_line_list[5],
translated_portal_type='',
state='Draft',
count=2)
def test_suite(): def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestTradeReports)) suite.addTest(unittest.makeSuite(TestTradeReports))
......
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