[Erp5-report] r31123 jerome - /erp5/trunk/products/ERP5/tests/testAccountingReports.py

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Dec 7 15:06:39 CET 2009


Author: jerome
Date: Mon Dec  7 15:06:38 2009
New Revision: 31123

URL: http://svn.erp5.org?rev=31123&view=rev
Log:
tests section columns on account statement

Modified:
    erp5/trunk/products/ERP5/tests/testAccountingReports.py

Modified: erp5/trunk/products/ERP5/tests/testAccountingReports.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testAccountingReports.py?rev=31123&r1=31122&r2=31123&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testAccountingReports.py [utf8] (original)
+++ erp5/trunk/products/ERP5/tests/testAccountingReports.py [utf8] Mon Dec  7 15:06:38 2009
@@ -659,7 +659,7 @@
     request_form['node'] = \
                 self.portal.account_module.receivable.getRelativeUrl()
     request_form['at_date'] = DateTime(2006, 2, 2)
-    request_form['section_category'] = 'group/demo_group'
+    request_form['section_category'] = 'group/demo_group/sub1'
     request_form['simulation_state'] = ['delivered']
     
     report_section_list = self.getReportSectionList(
@@ -1414,6 +1414,81 @@
     self.checkLineProperties(line_list[-1], debit=0, credit=0,)
 
 
+  def testAccountStatementMultipleSection(self):
+    # When there are multiple sections for the same group, an extra column
+    # is added for the section
+    account_module = self.portal.account_module
+    t1 = self._makeOne(
+              portal_type='Accounting Transaction',
+              title='Transaction 1',
+              source_reference='1',
+              simulation_state='delivered',
+              destination_section_value=self.organisation_module.client_1,
+              start_date=DateTime(2006, 2, 1),
+              lines=(dict(source_value=account_module.receivable,
+                          source_debit=100.0),
+                     dict(source_value=account_module.payable,
+                          source_credit=100.0)))
+    
+    t2 = self._makeOne(
+              portal_type='Accounting Transaction',
+              title='Transaction 2',
+              source_reference='2',
+              source_section_value=self.main_section,
+              simulation_state='delivered',
+              destination_section_value=self.organisation_module.client_1,
+              start_date=DateTime(2006, 2, 1, 0, 1),
+              lines=(dict(source_value=account_module.payable,
+                          source_debit=200.0),
+                     dict(source_value=account_module.receivable,
+                          source_credit=200.0)))
+    
+    # set request variables and render                 
+    request_form = self.portal.REQUEST.form
+    request_form['node'] = \
+                self.portal.account_module.receivable.getRelativeUrl()
+    request_form['at_date'] = DateTime(2006, 2, 2)
+    request_form['section_category'] = 'group/demo_group'
+    request_form['simulation_state'] = ['delivered']
+    
+    report_section_list = self.getReportSectionList(
+                                    self.portal.accounting_module,
+                                    'AccountModule_viewAccountStatementReport')
+    self.assertEquals(1, len(report_section_list))
+    line_list = self.getListBoxLineList(report_section_list[0])
+    data_line_list = [l for l in line_list if l.isDataLine()]
+    self.assertEquals(2, len(data_line_list))
+    
+    self.assertEquals(data_line_list[0].column_id_list,
+        ['Movement_getSpecificReference', 'date',
+         'Movement_getExplanationTitle', 'section_title',
+         'Movement_getMirrorSectionTitle',
+         'debit', 'credit', 'running_total_price'])
+
+    self.checkLineProperties(data_line_list[0],
+                             Movement_getSpecificReference='1',
+                             date=DateTime(2006, 2, 1),
+                             section_title='My Organisation',
+                             Movement_getExplanationTitle='Transaction 1',
+                             Movement_getMirrorSectionTitle='Client 1',
+                             debit=100,
+                             credit=0,
+                             running_total_price=100)
+
+    self.checkLineProperties(data_line_list[1],
+                             Movement_getSpecificReference='2',
+                             date=DateTime(2006, 2, 1, 0, 1),
+                             section_title='My Master Organisation',
+                             Movement_getExplanationTitle='Transaction 2',
+                             Movement_getMirrorSectionTitle='Client 1',
+                             debit=0,
+                             credit=200,
+                             running_total_price=-100)
+    
+    self.failUnless(line_list[-1].isStatLine())
+    self.checkLineProperties(line_list[-1], debit=100, credit=200)
+
+
   def testTrialBalance(self):
     # Simple test of trial balance
     # we will use the same data set as account statement




More information about the Erp5-report mailing list