Commit 5629ef2a authored by Jérome Perrin's avatar Jérome Perrin

tests for cancellation amount in accounting reports


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27719 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent e289275c
...@@ -1281,6 +1281,74 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -1281,6 +1281,74 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
self.checkLineProperties(line_list[-1], debit=700, credit=0) self.checkLineProperties(line_list[-1], debit=700, credit=0)
def testAccountStatementCancellationAmount(self):
# Account statement with cancellation amount set on lines
account_module = self.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, 0, 1),
lines=(dict(source_value=account_module.payable,
source_debit=100.0,),
dict(source_value=account_module.receivable,
source_debit=-100.0,
cancellation_amount=True)))
t2 = self._makeOne(
portal_type='Accounting Transaction',
title='Transaction 2',
source_reference='2',
simulation_state='delivered',
destination_section_value=self.organisation_module.client_1,
start_date=DateTime(2006, 2, 1, 0, 2),
lines=(dict(source_value=account_module.payable,
source_credit=200.0),
dict(source_value=account_module.receivable,
source_credit=-200.0,
cancellation_amount=True)))
# set request variables and render
request_form = self.portal.REQUEST.form
request_form['node'] = \
self.portal.account_module.receivable.getRelativeUrl()
request_form['from_date'] = DateTime(2006, 1, 1)
request_form['at_date'] = DateTime(2006, 12, 31)
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.checkLineProperties(data_line_list[0],
Movement_getSpecificReference='1',
date=DateTime(2006, 2, 1, 0, 1),
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, 2),
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): def testTrialBalance(self):
# Simple test of trial balance # Simple test of trial balance
# we will use the same data set as account statement # we will use the same data set as account statement
......
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