Commit de0abcb9 authored by Jérome Perrin's avatar Jérome Perrin

trade: add simple test for "Lines Report"

parent ed84c574
......@@ -1945,6 +1945,61 @@ class TestTradeReports(ERP5ReportTestCase):
# delivery_resource_text shows quantities and variations
delivery_resource_text="ref 1: 1.0\nref 3 colour1: 3.0\nref 3 colour2: 2.0")
def test_LinesReport(self):
# Create sales orders
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},},
)
self._makeOneSaleOrder(
title='SO 2 (cancelled)',
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},},
cancel=True,
)
# view the module first, it will set selection
self.portal.REQUEST.form['simulation_state'] = 'draft'
view = self.portal.sale_order_module.view()
self.assertFalse('Site Error' in view)
self.portal.REQUEST.form['portal_type'] = ['Sale Order Line']
report_section, = self.getReportSectionList(
self.sale_order_module,
'DeliveryModule_viewDeliveryLineReport')
line_list = sorted(
(l for l in self.getListBoxLineList(report_section) if l.isDataLine()),
key=lambda x:x.getColumnProperty('quantity'))
self.assertEqual(len(line_list), 2)
self.checkLineProperties(
line_list[0],
start_date=DateTime(2006, 2, 2),
quantity=7,
price=6,
)
self.checkLineProperties(
line_list[1],
start_date=DateTime(2006, 2, 2),
quantity=11,
price=3,
)
def test_suite():
suite = unittest.TestSuite()
......
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