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

accounting: display mirror section title in GL initial balance line

parent aa66b679
...@@ -177,6 +177,7 @@ if from_date or is_pl_account: ...@@ -177,6 +177,7 @@ if from_date or is_pl_account:
Movement_getExplanationTranslatedPortalType='', Movement_getExplanationTranslatedPortalType='',
Movement_getExplanationReference='', Movement_getExplanationReference='',
Movement_getMirrorSectionTitle='', Movement_getMirrorSectionTitle='',
mirror_section_title='',
Movement_getNodeGapId='', Movement_getNodeGapId='',
getListItemUrl=lambda *args,**kw: None, getListItemUrl=lambda *args,**kw: None,
Movement_getExplanationUrl=lambda **kw:None, Movement_getExplanationUrl=lambda **kw:None,
...@@ -195,6 +196,11 @@ if from_date or is_pl_account: ...@@ -195,6 +196,11 @@ if from_date or is_pl_account:
Movement_getNodeGapId=node.Account_getGapId(), Movement_getNodeGapId=node.Account_getGapId(),
node_translated_title=node.getTranslatedTitle() node_translated_title=node.getTranslatedTitle()
) )
if params.get('mirror_section_uid'):
mirror_section = portal.portal_catalog.getObject(params['mirror_section_uid'])
previous_balance.edit(
mirror_section_title=mirror_section.getTitle()
)
section = portal.portal_catalog.getObject(section_uid) section = portal.portal_catalog.getObject(section_uid)
previous_balance.edit( previous_balance.edit(
Movement_getSectionPriceCurrency=section.getPriceCurrencyReference(), Movement_getSectionPriceCurrency=section.getPriceCurrencyReference(),
......
...@@ -4020,6 +4020,114 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -4020,6 +4020,114 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
self.assertEqual(1, len(data_line_list)) self.assertEqual(1, len(data_line_list))
self.checkLineProperties(data_line_list[0], debit_price=2900, credit_price=2900) self.checkLineProperties(data_line_list[0], debit_price=2900, credit_price=2900)
def testGeneralLedgerInitialBalance(self):
# Initial balance line on GL
# we will use the same data set as account statement
self.createAccountStatementDataSetOnTwoPeriods()
# set request variables and render
request_form = self.portal.REQUEST.form
request_form['from_date'] = DateTime(2006, 2, 1)
request_form['at_date'] = DateTime(2006, 12, 31)
request_form['gap_list'] = [
'my_country/my_accounting_standards/4/41']
request_form['section_category'] = 'group/demo_group'
request_form['section_category_strict'] = False
request_form['simulation_state'] = ['delivered']
request_form['hide_analytic'] = False
request_form['export'] = False
report_section_list = self.getReportSectionList(
self.portal.accounting_module,
'AccountModule_viewGeneralLedgerReport')
self.assertEqual(2, len(report_section_list))
self.assertEqual(
'41 - Receivable (Client 1)',
report_section_list[0].getTitle())
line_list = self.getListBoxLineList(report_section_list[0])
data_line_list = [l for l in line_list if l.isDataLine()]
self.assertEqual(2, len(data_line_list))
self.checkLineProperties(
data_line_list[0],
Movement_getSpecificReference='Previous Balance',
mirror_section_title='Client 1',
date=DateTime(2006, 2, 1),
debit_price=300,
credit_price=0,
running_total_price=300, )
self.checkLineProperties(
data_line_list[1],
Movement_getSpecificReference='3',
Movement_getExplanationTitleAndAnalytics='Transaction 3\nref3',
date=DateTime(2006, 2, 2),
debit_price=300,
credit_price=0,
running_total_price=600, )
self.assertTrue(line_list[-1].isStatLine())
self.checkLineProperties(line_list[-1],
Movement_getSpecificReference=None,
Movement_getExplanationTitleAndAnalytics=None,
date=None,
debit_price=600, credit_price=0, )
self.assertEqual('Total', report_section_list[1].getTitle())
line_list = self.getListBoxLineList(report_section_list[1])
data_line_list = [l for l in line_list if l.isDataLine()]
self.assertEqual(1, len(data_line_list))
self.checkLineProperties(
data_line_list[0],
debit_price=600,
credit_price=0)
def testGeneralLedgerExportInitialBalance(self):
# Initial balance on GL export
# we will use the same data set as account statement
self.createAccountStatementDataSetOnTwoPeriods()
# set request variables and render
request_form = self.portal.REQUEST.form
request_form['from_date'] = DateTime(2006, 2, 1)
request_form['at_date'] = DateTime(2006, 12, 31)
request_form['gap_list'] = [
'my_country/my_accounting_standards/4/41']
request_form['section_category'] = 'group/demo_group'
request_form['section_category_strict'] = False
request_form['simulation_state'] = ['delivered']
request_form['hide_analytic'] = False
request_form['export'] = True
report_section_list = self.getReportSectionList(
self.portal.accounting_module,
'AccountModule_viewGeneralLedgerReport')
self.assertEqual(1, len(report_section_list))
# export mode has no section headers
self.assertEqual(None, report_section_list[0].getTitle())
line_list = self.getListBoxLineList(report_section_list[0])
data_line_list = [l for l in line_list if l.isDataLine()]
self.assertEqual(2, len(data_line_list))
self.checkLineProperties(
data_line_list[0],
Movement_getSpecificReference='Previous Balance',
mirror_section_title='Client 1',
date=DateTime(2006, 2, 1),
debit_price=300,
credit_price=0, )
self.checkLineProperties(
data_line_list[1],
Movement_getSpecificReference='3',
mirror_section_title='Client 1',
date=DateTime(2006, 2, 2),
debit_price=300,
credit_price=0, )
self.assertFalse(line_list[-1].isStatLine())
def testGeneralLedgerGAPFilter(self): def testGeneralLedgerGAPFilter(self):
# General Ledger filtered by GAP category # General Ledger filtered by GAP category
......
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