Commit 72dfb2c4 authored by Jérome Perrin's avatar Jérome Perrin

accounting: apply the same change than GL on account statement

parent 8c313674
...@@ -30,7 +30,9 @@ ...@@ -30,7 +30,9 @@
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
<value> <string></string> </value> <value>
<none/>
</value>
</item> </item>
<item> <item>
<key> <string>icon</string> </key> <key> <string>icon</string> </key>
...@@ -73,7 +75,7 @@ ...@@ -73,7 +75,7 @@
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
string:${object_url}/AccountModule_viewAccountStatementReportDialog?your_portal_skin=ODS&your_format= string:${object_url}/AccountModule_viewAccountStatementReportDialog?your_portal_skin=ODS&your_format=&field_your_export:int=1
]]></string> </value> ]]></string> </value>
</item> </item>
......
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
string:${object_url}/accounting_module/AccountModule_viewAccountStatementReportDialog?mirror_section=${object/getRelativeUrl}&your_portal_skin=ODS&your_format= string:${object_url}/accounting_module/AccountModule_viewAccountStatementReportDialog?mirror_section=${object/getRelativeUrl}&your_portal_skin=ODS&your_format=&field_your_export:int=1
]]></string> </value> ]]></string> </value>
</item> </item>
......
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
string:${object_url}/accounting_module/AccountModule_viewAccountStatementReportDialog?mirror_section=${object/getRelativeUrl}&your_portal_skin=ODS&your_format= string:${object_url}/accounting_module/AccountModule_viewAccountStatementReportDialog?mirror_section=${object/getRelativeUrl}&your_portal_skin=ODS&your_format=&field_your_export:int=1
]]></string> </value> ]]></string> </value>
</item> </item>
......
...@@ -90,6 +90,8 @@ period_start_date = context\\\n ...@@ -90,6 +90,8 @@ period_start_date = context\\\n
section_category=request[\'section_category\'],\n section_category=request[\'section_category\'],\n
date=from_date or at_date)\n date=from_date or at_date)\n
\n \n
export = request[\'export\']\n
\n
# Also get the currency, to know the precision\n # Also get the currency, to know the precision\n
currency = context.Base_getCurrencyForSection(request[\'section_category\'])\n currency = context.Base_getCurrencyForSection(request[\'section_category\'])\n
precision = context.account_module.getQuantityPrecisionFromResource(currency)\n precision = context.account_module.getQuantityPrecisionFromResource(currency)\n
...@@ -144,21 +146,27 @@ if hide_analytic:\n ...@@ -144,21 +146,27 @@ if hide_analytic:\n
else:\n else:\n
analytic_column_list = context.AccountModule_getAnalyticColumnList()\n analytic_column_list = context.AccountModule_getAnalyticColumnList()\n
params[\'analytic_column_list\'] = analytic_column_list\n params[\'analytic_column_list\'] = analytic_column_list\n
request.set(\'analytic_column_list\', analytic_column_list) # for Movement_getExplanationTitleAndAnalytics\n
\n \n
selection_columns = (\n selection_columns = (\n
(\'date\', \'Operation Date\'),\n
(\'Movement_getSpecificReference\', \'Transaction Reference\'),\n (\'Movement_getSpecificReference\', \'Transaction Reference\'),\n
(\'date\', \'Date\'),\n (\'Movement_getExplanationTitleAndAnalytics\', \'Title\\nReference and Analytics\' if analytic_column_list else \'Title\\nReference\'),\n
(\'Movement_getExplanationTitle\', \'Accounting Transaction Title\'), )\n )\n
if len(section_uid) > 1:\n if len(section_uid) > 1:\n
selection_columns += ( (\'section_title\', \'Section\'), )\n selection_columns += ((\'section_title\', \'Section\'),)\n
selection_columns += analytic_column_list\n
if not mirror_section:\n
selection_columns += ( (\'Movement_getMirrorSectionTitle\', \'Third Party\'), )\n
selection_columns += (\n selection_columns += (\n
(\'Movement_getExplanationReference\', \'Document Reference\'),\n
(\'debit_price\', \'Debit\'),\n (\'debit_price\', \'Debit\'),\n
(\'credit_price\', \'Credit\'),\n (\'credit_price\', \'Credit\'),\n
(\'running_total_price\', \'Net\'),)\n (\'running_total_price\', \'Running Balance\'),\n
(\'grouping_reference\', \'Grouping Reference\'),\n
(\'grouping_date\', \'Grouping Date\'),\n
(\'modification_date\', \'Modification Date\'),\n
(\'getTranslatedSimulationStateTitle\', \'State\'),\n
)\n
\n
if export:\n
selection_columns = context.AccountModule_getGeneralLedgerColumnItemList()\n
\n \n
report_section_list = []\n report_section_list = []\n
if from_date and detailed_from_date_summary:\n if from_date and detailed_from_date_summary:\n
...@@ -185,7 +193,7 @@ if from_date and detailed_from_date_summary:\n ...@@ -185,7 +193,7 @@ if from_date and detailed_from_date_summary:\n
report_section_list.append(\n report_section_list.append(\n
ReportSection(\n ReportSection(\n
path=node,\n path=node,\n
form_id=\'Account_viewAccountingTransactionList\',\n form_id=\'Account_viewAccountingTransactionListExport\' if export else \'Account_viewAccountingTransactionList\',\n
selection_name=\'account_preference_selection\',\n selection_name=\'account_preference_selection\',\n
selection_params=params,\n selection_params=params,\n
selection_columns=selection_columns,\n selection_columns=selection_columns,\n
......
...@@ -112,6 +112,7 @@ ...@@ -112,6 +112,7 @@
<list> <list>
<string>your_simulation_state</string> <string>your_simulation_state</string>
<string>your_portal_type</string> <string>your_portal_type</string>
<string>your_export</string>
</list> </list>
</value> </value>
</item> </item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>css_class</string>
<string>hidden</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>your_export</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>css_class</string> </key>
<value> <string>hidden_label</string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_checkbox</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Export Mode</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -51,12 +51,9 @@ ...@@ -51,12 +51,9 @@
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>from Products.PythonScripts.standard import Object\n <value> <string>from Products.PythonScripts.standard import Object\n
from Products.ERP5Type.Document import newTempBase\n
from Products.ERP5Type.Message import Message\n
portal = context.getPortalObject()\n portal = context.getPortalObject()\n
getObject = portal.portal_catalog.getObject\n getObject = portal.portal_catalog.getObject\n
params = portal.ERP5Accounting_getParams(selection_name)\n params = portal.ERP5Accounting_getParams(selection_name)\n
N_ = lambda msg: Message(\'erp5_ui\', msg)\n
\n \n
# this also prevents to be called directly\n # this also prevents to be called directly\n
assert \'node_uid\' in kw\n assert \'node_uid\' in kw\n
...@@ -86,87 +83,70 @@ for brain in portal.Base_zGetNotGroupedMovementList(\n ...@@ -86,87 +83,70 @@ for brain in portal.Base_zGetNotGroupedMovementList(\n
portal_type=portal.getPortalAccountingMovementTypeList(),\n portal_type=portal.getPortalAccountingMovementTypeList(),\n
section_uid=params[\'section_uid\']):\n section_uid=params[\'section_uid\']):\n
\n \n
# manually filter out not interesting lines\n # manually filter out not interesting lines\n
# XXX this is because Base_zGetNotGroupedMovementList is really\n # XXX this is because Base_zGetNotGroupedMovementList is really\n
# minimalistic\n # minimalistic\n
if mirror_section_relative_url and \\\n if mirror_section_relative_url and \\\n
brain.mirror_section_relative_url != mirror_section_relative_url:\n brain.mirror_section_relative_url != mirror_section_relative_url:\n
continue\n continue\n
\n
mvt = brain.getObject()\n
transaction = mvt.getParentValue()\n
\n
if portal_type_filter and \\\n
transaction.getPortalType() not in portal_type_list:\n
continue\n
\n \n
is_source = (brain.mirror_section_relative_url == mvt.getDestinationSection())\n mvt = brain.getObject()\n
if is_source:\n transaction = mvt.getParentValue()\n
if payment_uid and mvt.getSourcePaymentUid() != payment_uid:\n \n
continue\n if portal_type_filter and \\\n
if project_uid and mvt.getSourceProjectUid() != project_uid:\n transaction.getPortalType() not in portal_type_list:\n
continue\n continue\n
if function and not (mvt.getSourceFunction() or \'\').startswith(function):\n
continue\n
specific_reference = transaction.getSourceReference()\n
mirror_section_title = mvt.getDestinationSectionTitle()\n
section_title = mvt.getSourceSectionTitle()\n
else:\n
if payment_uid and mvt.getDestinationPaymentUid() != payment_uid:\n
continue\n
if project_uid and mvt.getDestinationProjectUid() != project_uid:\n
continue\n
if function and not (mvt.getDestinationFunction() or \'\').startswith(function):\n
continue\n
specific_reference = transaction.getDestinationReference()\n
mirror_section_title = mvt.getSourceSectionTitle()\n
section_title = mvt.getDestinationSectionTitle()\n
\n
\n \n
debit = max(brain.total_quantity, 0)\n is_source = (brain.mirror_section_relative_url == mvt.getDestinationSection())\n
total_debit += debit\n if is_source:\n
credit = max(-brain.total_quantity, 0)\n if payment_uid and mvt.getSourcePaymentUid() != payment_uid:\n
total_credit += credit\n continue\n
if project_uid and mvt.getSourceProjectUid() != project_uid:\n
continue\n
if function and not (mvt.getSourceFunction() or \'\').startswith(function):\n
continue\n
specific_reference = transaction.getSourceReference()\n
mirror_section_title = mvt.getDestinationSectionTitle()\n
section_title = mvt.getSourceSectionTitle()\n
else:\n
if payment_uid and mvt.getDestinationPaymentUid() != payment_uid:\n
continue\n
if project_uid and mvt.getDestinationProjectUid() != project_uid:\n
continue\n
if function and not (mvt.getDestinationFunction() or \'\').startswith(function):\n
continue\n
specific_reference = transaction.getDestinationReference()\n
mirror_section_title = mvt.getSourceSectionTitle()\n
section_title = mvt.getDestinationSectionTitle()\n
\n
\n \n
debit_price = max(brain.total_price, 0)\n debit = max(brain.total_quantity, 0)\n
total_debit_price += debit_price\n total_debit += debit\n
credit_price = max(-brain.total_price, 0)\n credit = max(-brain.total_quantity, 0)\n
total_credit_price += credit_price\n total_credit += credit\n
\n \n
brain_date = brain.date\n debit_price = max(brain.total_price, 0)\n
if mvt.getStartDate():\n total_debit_price += debit_price\n
brain_date = brain_date.toZone(mvt.getStartDate().timezone())\n credit_price = max(-brain.total_price, 0)\n
\n total_credit_price += credit_price\n
line = Object(uid=\'new_000\',\n
total_price=brain.total_price,\n
date=brain.date,\n
Movement_getSpecificReference=specific_reference,\n
Movement_getMirrorSectionTitle=mirror_section_title,\n
section_title=section_title,\n
debit=debit,\n
credit=credit,\n
debit_price=debit_price,\n
credit_price=credit_price,\n
Movement_getExplanationTitle=\n
mvt.hasTitle() and mvt.getTitle() or transaction.getTitle())\n
\n \n
analytic_info = {}\n brain_date = brain.date\n
for analytic_column, analytic_column_title in analytic_column_list:\n if mvt.getStartDate():\n
if analytic_column == \'project\':\n brain_date = brain_date.toZone(mvt.getStartDate().timezone())\n
if is_source:\n \n
analytic_info[\'project\'] = mvt.asContext(project_uid=mvt.getSourceProjectUid()).Movement_getProjectTitle()\n line = Object(uid=\'new_000\',\n
else:\n total_price=brain.total_price,\n
analytic_info[\'project\'] = mvt.asContext(project_uid=mvt.getDestinationProjectUid()).Movement_getProjectTitle()\n date=brain.date,\n
elif analytic_column == \'function\':\n Movement_getSpecificReference=specific_reference,\n
if is_source:\n mirror_section_title=mirror_section_title,\n
analytic_info[\'function\'] = mvt.asContext(function_uid=mvt.getDestinationFunctionUid()).Movement_getFunctionTitle()\n section_title=section_title,\n
else:\n debit=debit,\n
analytic_info[\'function\'] = mvt.asContext(function_uid=mvt.getDestinationFunctionUid()).Movement_getFunctionTitle()\n credit=credit,\n
else:\n debit_price=debit_price,\n
analytic_info[analytic_column] = mvt.getProperty(analytic_column)\n credit_price=credit_price,\n
Movement_getExplanationTitleAndAnalytics=brain.Movement_getExplanationTitleAndAnalytics(brain))\n
\n \n
line.update(analytic_info)\n line_list.append(line)\n
line_list.append(line)\n
\n \n
\n \n
context.REQUEST.set(\n context.REQUEST.set(\n
......
...@@ -673,6 +673,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -673,6 +673,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
t1 = self._makeOne( t1 = self._makeOne(
portal_type='Sale Invoice Transaction', portal_type='Sale Invoice Transaction',
title='Transaction 1', title='Transaction 1',
reference='ref1',
source_reference='1', source_reference='1',
simulation_state='delivered', simulation_state='delivered',
destination_section_value=self.organisation_module.client_1, destination_section_value=self.organisation_module.client_1,
...@@ -685,6 +686,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -685,6 +686,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
t2 = self._makeOne( t2 = self._makeOne(
portal_type='Sale Invoice Transaction', portal_type='Sale Invoice Transaction',
title='Transaction 2', title='Transaction 2',
reference='ref2',
source_reference='2', source_reference='2',
simulation_state='delivered', simulation_state='delivered',
destination_section_value=self.organisation_module.client_1, destination_section_value=self.organisation_module.client_1,
...@@ -697,6 +699,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -697,6 +699,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
t3 = self._makeOne( t3 = self._makeOne(
portal_type='Sale Invoice Transaction', portal_type='Sale Invoice Transaction',
title='Transaction 3', title='Transaction 3',
reference='ref3',
source_reference='3', source_reference='3',
simulation_state='delivered', simulation_state='delivered',
destination_section_value=self.organisation_module.client_1, destination_section_value=self.organisation_module.client_1,
...@@ -823,6 +826,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -823,6 +826,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
request_form['section_category_strict'] = False request_form['section_category_strict'] = False
request_form['simulation_state'] = ['delivered'] request_form['simulation_state'] = ['delivered']
request_form['hide_analytic'] = False request_form['hide_analytic'] = False
request_form['export'] = False
report_section_list = self.getReportSectionList( report_section_list = self.getReportSectionList(
self.portal.accounting_module, self.portal.accounting_module,
...@@ -845,80 +849,68 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -845,80 +849,68 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
# test columns values # test columns values
line = data_line_list[0] line = data_line_list[0]
self.assertEqual(line.column_id_list, self.assertEqual(line.column_id_list,
['Movement_getSpecificReference', 'date', ['date', 'Movement_getSpecificReference',
'Movement_getExplanationTitle', 'Movement_getMirrorSectionTitle', 'Movement_getExplanationTitleAndAnalytics', 'debit_price',
'Movement_getExplanationReference', 'credit_price', 'running_total_price', 'grouping_reference',
'debit_price', 'credit_price', 'running_total_price']) 'grouping_date', 'modification_date',
'getTranslatedSimulationStateTitle'])
self.checkLineProperties(data_line_list[0], self.checkLineProperties(data_line_list[0],
Movement_getSpecificReference='1', Movement_getSpecificReference='1',
Movement_getExplanationReference='ref1', date=DateTime(2006, 2, 1),
date=DateTime(2006, 2, 1), Movement_getExplanationTitleAndAnalytics='Transaction 1\nref1',
Movement_getExplanationTitle='Transaction 1', debit_price=100,
Movement_getMirrorSectionTitle='Client 1', credit_price=0,
debit_price=100, running_total_price=100)
credit_price=0,
running_total_price=100)
self.checkLineProperties(data_line_list[1], self.checkLineProperties(data_line_list[1],
Movement_getSpecificReference='2', Movement_getSpecificReference='2',
Movement_getExplanationReference='ref2', date=DateTime(2006, 2, 1, 0, 1),
date=DateTime(2006, 2, 1, 0, 1), Movement_getExplanationTitleAndAnalytics='Transaction 2\nref2',
Movement_getExplanationTitle='Transaction 2', debit_price=0,
Movement_getMirrorSectionTitle='Client 1', credit_price=200,
debit_price=0, running_total_price=-100)
credit_price=200,
running_total_price=-100)
self.checkLineProperties(data_line_list[2], self.checkLineProperties(data_line_list[2],
Movement_getSpecificReference='3', Movement_getSpecificReference='3',
Movement_getExplanationReference='ref3', date=DateTime(2006, 2, 2, 0, 2),
date=DateTime(2006, 2, 2, 0, 2), Movement_getExplanationTitleAndAnalytics='Transaction 3\nref3',
Movement_getExplanationTitle='Transaction 3', debit_price=300,
Movement_getMirrorSectionTitle='Client 1', credit_price=0,
debit_price=300, running_total_price=200)
credit_price=0,
running_total_price=200)
self.checkLineProperties(data_line_list[3], self.checkLineProperties(data_line_list[3],
Movement_getSpecificReference='4', Movement_getSpecificReference='4',
Movement_getExplanationReference='ref4', date=DateTime(2006, 2, 2, 0, 3),
date=DateTime(2006, 2, 2, 0, 3), Movement_getExplanationTitleAndAnalytics='Transaction 4\nref4',
Movement_getExplanationTitle='Transaction 4', debit_price=400,
Movement_getMirrorSectionTitle='Client 2', credit_price=0,
debit_price=400, running_total_price=600)
credit_price=0,
running_total_price=600)
self.checkLineProperties(data_line_list[4], self.checkLineProperties(data_line_list[4],
Movement_getSpecificReference='5', Movement_getSpecificReference='5',
Movement_getExplanationReference='ref5', date=DateTime(2006, 2, 2, 0, 4),
date=DateTime(2006, 2, 2, 0, 4), Movement_getExplanationTitleAndAnalytics='Transaction 5\nref5',
Movement_getExplanationTitle='Transaction 5', debit_price=500,
Movement_getMirrorSectionTitle='John Smith', credit_price=0,
debit_price=500, running_total_price=1100)
credit_price=0,
running_total_price=1100)
self.checkLineProperties(data_line_list[5], self.checkLineProperties(data_line_list[5],
Movement_getSpecificReference='6', Movement_getSpecificReference='6',
Movement_getExplanationReference='ref6', date=DateTime(2006, 2, 2, 0, 5),
date=DateTime(2006, 2, 2, 0, 5), Movement_getExplanationTitleAndAnalytics='Transaction 6\nref6',
Movement_getExplanationTitle='Transaction 6', debit_price=600,
Movement_getMirrorSectionTitle='Client 1', credit_price=0,
debit_price=600, running_total_price=1700)
credit_price=0,
running_total_price=1700)
self.assertTrue(line_list[-1].isStatLine()) self.assertTrue(line_list[-1].isStatLine())
self.checkLineProperties(line_list[-1], self.checkLineProperties(line_list[-1],
Movement_getSpecificReference=None, Movement_getSpecificReference=None,
date=None, date=None,
Movement_getExplanationTitle=None, Movement_getExplanationTitleAndAnalytics=None,
Movement_getMirrorSectionTitle=None, debit_price=1900,
debit_price=1900, credit_price=200,
credit_price=200, running_total_price=None)
running_total_price=None)
def testAccountStatementFromDateSummary(self): def testAccountStatementFromDateSummary(self):
...@@ -935,6 +927,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -935,6 +927,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
request_form['section_category_strict'] = False request_form['section_category_strict'] = False
request_form['simulation_state'] = ['delivered'] request_form['simulation_state'] = ['delivered']
request_form['hide_analytic'] = False request_form['hide_analytic'] = False
request_form['export'] = False
report_section_list = self.getReportSectionList( report_section_list = self.getReportSectionList(
self.portal.accounting_module, self.portal.accounting_module,
...@@ -946,49 +939,44 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -946,49 +939,44 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
self.assertEqual(5, len(data_line_list)) self.assertEqual(5, len(data_line_list))
self.checkLineProperties(data_line_list[0], self.checkLineProperties(data_line_list[0],
Movement_getSpecificReference='Previous Balance', Movement_getSpecificReference='Previous Balance',
date=DateTime(2006, 2, 2), date=DateTime(2006, 2, 2),
Movement_getExplanationTitle='', Movement_getExplanationTitleAndAnalytics=None,
Movement_getMirrorSectionTitle='', debit_price=100,
debit_price=100, credit_price=200,
credit_price=200, running_total_price=-100)
running_total_price=-100)
self.checkLineProperties(data_line_list[1], self.checkLineProperties(data_line_list[1],
Movement_getSpecificReference='3', Movement_getSpecificReference='3',
date=DateTime(2006, 2, 2, 0, 2), date=DateTime(2006, 2, 2, 0, 2),
Movement_getExplanationTitle='Transaction 3', Movement_getExplanationTitleAndAnalytics='Transaction 3\nref3',
Movement_getMirrorSectionTitle='Client 1', debit_price=300,
debit_price=300, credit_price=0,
credit_price=0, running_total_price=200)
running_total_price=200)
self.checkLineProperties(data_line_list[2], self.checkLineProperties(data_line_list[2],
Movement_getSpecificReference='4', Movement_getSpecificReference='4',
date=DateTime(2006, 2, 2, 0, 3), date=DateTime(2006, 2, 2, 0, 3),
Movement_getExplanationTitle='Transaction 4', Movement_getExplanationTitleAndAnalytics='Transaction 4\nref4',
Movement_getMirrorSectionTitle='Client 2', debit_price=400,
debit_price=400, credit_price=0,
credit_price=0, running_total_price=600)
running_total_price=600)
self.checkLineProperties(data_line_list[3], self.checkLineProperties(data_line_list[3],
Movement_getSpecificReference='5', Movement_getSpecificReference='5',
date=DateTime(2006, 2, 2, 0, 4), date=DateTime(2006, 2, 2, 0, 4),
Movement_getExplanationTitle='Transaction 5', Movement_getExplanationTitleAndAnalytics='Transaction 5\nref5',
Movement_getMirrorSectionTitle='John Smith', debit_price=500,
debit_price=500, credit_price=0,
credit_price=0, running_total_price=1100)
running_total_price=1100)
self.checkLineProperties(data_line_list[4], self.checkLineProperties(data_line_list[4],
Movement_getSpecificReference='6', Movement_getSpecificReference='6',
date=DateTime(2006, 2, 2, 0, 5), date=DateTime(2006, 2, 2, 0, 5),
Movement_getExplanationTitle='Transaction 6', Movement_getExplanationTitleAndAnalytics='Transaction 6\nref6',
Movement_getMirrorSectionTitle='Client 1', debit_price=600,
debit_price=600, credit_price=0,
credit_price=0, running_total_price=1700)
running_total_price=1700)
self.assertTrue(line_list[-1].isStatLine()) self.assertTrue(line_list[-1].isStatLine())
self.checkLineProperties(line_list[-1], debit_price=1900, credit_price=200,) self.checkLineProperties(line_list[-1], debit_price=1900, credit_price=200,)
...@@ -1009,6 +997,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -1009,6 +997,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
request_form['section_category_strict'] = False request_form['section_category_strict'] = False
request_form['simulation_state'] = ['delivered'] request_form['simulation_state'] = ['delivered']
request_form['hide_analytic'] = False request_form['hide_analytic'] = False
request_form['export'] = False
report_section_list = self.getReportSectionList( report_section_list = self.getReportSectionList(
self.portal.accounting_module, self.portal.accounting_module,
...@@ -1078,6 +1067,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -1078,6 +1067,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
request_form['simulation_state'] = ['delivered'] request_form['simulation_state'] = ['delivered']
request_form['hide_analytic'] = False request_form['hide_analytic'] = False
request_form['omit_grouping_reference'] = True request_form['omit_grouping_reference'] = True
request_form['export'] = False
report_section_list = self.getReportSectionList( report_section_list = self.getReportSectionList(
self.portal.accounting_module, self.portal.accounting_module,
...@@ -1089,35 +1079,25 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -1089,35 +1079,25 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
# we have 1 transactions, because 1st is grouped during the period. # we have 1 transactions, because 1st is grouped during the period.
self.assertEqual(1, len(data_line_list)) self.assertEqual(1, len(data_line_list))
# test columns values
line = data_line_list[0]
self.assertEqual(line.column_id_list,
['Movement_getSpecificReference', 'date',
'Movement_getExplanationTitle', 'Movement_getMirrorSectionTitle',
'Movement_getExplanationReference',
'debit_price', 'credit_price', 'running_total_price'])
self.checkLineProperties(data_line_list[0], self.checkLineProperties(data_line_list[0],
Movement_getSpecificReference='2', Movement_getSpecificReference='2',
Movement_getExplanationReference='ref2', date=DateTime(2006, 2, 3),
date=DateTime(2006, 2, 3), Movement_getExplanationTitleAndAnalytics='Grouped after period\nref2',
Movement_getExplanationTitle='Grouped after period', grouping_reference='B',
Movement_getMirrorSectionTitle='Client 2', grouping_date=DateTime(2006, 3, 2),
debit_price=239.20, debit_price=239.20,
credit_price=0, credit_price=0,
running_total_price=239.20) running_total_price=239.20)
self.assertTrue(line_list[-1].isStatLine()) self.assertTrue(line_list[-1].isStatLine())
self.checkLineProperties(line_list[-1], self.checkLineProperties(line_list[-1],
Movement_getSpecificReference=None, Movement_getSpecificReference=None,
date=None, date=None,
Movement_getExplanationTitle=None, # The bottom line remain the same as when showing
Movement_getMirrorSectionTitle=None, # grouped lines
# The bottom line remain the same as when showing debit_price=358.80,
# grouped lines credit_price=0,
debit_price=358.80, running_total_price=None)
credit_price=0,
running_total_price=None)
def testGeneralLedgerHideGrouping(self): def testGeneralLedgerHideGrouping(self):
# similar to testAccountStatementHideGrouping, but in general ledger. # similar to testAccountStatementHideGrouping, but in general ledger.
...@@ -1195,6 +1175,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -1195,6 +1175,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
t1 = self._makeOne( t1 = self._makeOne(
portal_type='Accounting Transaction', portal_type='Accounting Transaction',
title='Transaction 1', title='Transaction 1',
reference='ref1',
source_reference='1', source_reference='1',
simulation_state='delivered', simulation_state='delivered',
destination_section_value=self.organisation_module.client_1, destination_section_value=self.organisation_module.client_1,
...@@ -1207,6 +1188,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -1207,6 +1188,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
t2 = self._makeOne( t2 = self._makeOne(
portal_type='Sale Invoice Transaction', portal_type='Sale Invoice Transaction',
title='Transaction 2', title='Transaction 2',
reference='ref2',
source_reference='2', source_reference='2',
destination_section_value=self.organisation_module.client_1, destination_section_value=self.organisation_module.client_1,
start_date=DateTime(2006, 2, 2), start_date=DateTime(2006, 2, 2),
...@@ -1220,6 +1202,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -1220,6 +1202,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
t3 = self._makeOne( t3 = self._makeOne(
portal_type='Payment Transaction', portal_type='Payment Transaction',
title='Transaction 3', title='Transaction 3',
reference='ref3',
source_reference='3', source_reference='3',
simulation_state='delivered', simulation_state='delivered',
causality_value=t2, causality_value=t2,
...@@ -1239,6 +1222,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -1239,6 +1222,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
t4 = self._makeOne( t4 = self._makeOne(
portal_type='Sale Invoice Transaction', portal_type='Sale Invoice Transaction',
title='Transaction 4', title='Transaction 4',
reference='ref4',
source_reference='4', source_reference='4',
destination_section_value=self.organisation_module.client_1, destination_section_value=self.organisation_module.client_1,
start_date=DateTime(2006, 2, 4), start_date=DateTime(2006, 2, 4),
...@@ -1250,6 +1234,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -1250,6 +1234,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
t5 = self._makeOne( t5 = self._makeOne(
portal_type='Payment Transaction', portal_type='Payment Transaction',
title='Transaction 5', title='Transaction 5',
reference='ref5',
source_reference='5', source_reference='5',
simulation_state='delivered', simulation_state='delivered',
causality_value=t4, causality_value=t4,
...@@ -1276,6 +1261,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -1276,6 +1261,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
request_form['simulation_state'] = ['delivered'] request_form['simulation_state'] = ['delivered']
request_form['detailed_from_date_summary'] = 1 request_form['detailed_from_date_summary'] = 1
request_form['hide_analytic'] = False request_form['hide_analytic'] = False
request_form['export'] = False
report_section_list = self.getReportSectionList( report_section_list = self.getReportSectionList(
self.portal.accounting_module, self.portal.accounting_module,
...@@ -1294,19 +1280,17 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -1294,19 +1280,17 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
# transaction 4, which is grouped with lines in the period. # transaction 4, which is grouped with lines in the period.
self.assertEqual(2, len(data_line_list)) self.assertEqual(2, len(data_line_list))
self.checkLineProperties(data_line_list[0], self.checkLineProperties(data_line_list[0],
Movement_getSpecificReference='1', Movement_getSpecificReference='1',
date=DateTime(2006, 2, 1), date=DateTime(2006, 2, 1),
Movement_getExplanationTitle='Transaction 1', Movement_getExplanationTitleAndAnalytics='Transaction 1\nref1',
Movement_getMirrorSectionTitle='Client 1', debit_price=100,
debit_price=100, credit_price=0,)
credit_price=0,)
self.checkLineProperties(data_line_list[1], self.checkLineProperties(data_line_list[1],
Movement_getSpecificReference='4', Movement_getSpecificReference='4',
date=DateTime(2006, 2, 4), date=DateTime(2006, 2, 4),
Movement_getExplanationTitle='Transaction 4', Movement_getExplanationTitleAndAnalytics='Transaction 4\nref4',
Movement_getMirrorSectionTitle='Client 1', debit_price=400,
debit_price=400, credit_price=0,)
credit_price=0,)
self.assertTrue(line_list[-1].isStatLine()) self.assertTrue(line_list[-1].isStatLine())
self.checkLineProperties(line_list[-1], debit_price=500, credit_price=0) self.checkLineProperties(line_list[-1], debit_price=500, credit_price=0)
...@@ -1316,21 +1300,18 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -1316,21 +1300,18 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
data_line_list = [l for l in line_list if l.isDataLine()] data_line_list = [l for l in line_list if l.isDataLine()]
self.assertEqual(2, len(data_line_list)) self.assertEqual(2, len(data_line_list))
self.checkLineProperties(data_line_list[0], self.checkLineProperties(data_line_list[0],
Movement_getSpecificReference='Previous Balance', Movement_getSpecificReference='Previous Balance',
date=DateTime(2006, 2, 25), date=DateTime(2006, 2, 25),
Movement_getExplanationTitle='', running_total_price=500,
Movement_getMirrorSectionTitle='', debit_price=700,
running_total_price=500, credit_price=200,)
debit_price=700,
credit_price=200,)
self.checkLineProperties(data_line_list[1], self.checkLineProperties(data_line_list[1],
Movement_getSpecificReference='5', Movement_getSpecificReference='5',
date=DateTime(2006, 3, 1), date=DateTime(2006, 3, 1),
Movement_getExplanationTitle='Transaction 5', Movement_getExplanationTitleAndAnalytics='Transaction 5\nref5',
Movement_getMirrorSectionTitle='Client 1', running_total_price=100,
running_total_price=100, debit_price=0,
debit_price=0, credit_price=400,)
credit_price=400,)
self.assertTrue(line_list[-1].isStatLine()) self.assertTrue(line_list[-1].isStatLine())
self.checkLineProperties(line_list[-1], debit_price=700, credit_price=600) self.checkLineProperties(line_list[-1], debit_price=700, credit_price=600)
...@@ -1348,6 +1329,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -1348,6 +1329,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
t1 = self._makeOne( t1 = self._makeOne(
portal_type='Accounting Transaction', portal_type='Accounting Transaction',
title='Transaction 1', title='Transaction 1',
reference='ref1',
source_reference='1', source_reference='1',
simulation_state='delivered', simulation_state='delivered',
destination_section_value=self.organisation_module.client_1, destination_section_value=self.organisation_module.client_1,
...@@ -1361,6 +1343,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -1361,6 +1343,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
t2 = self._makeOne( t2 = self._makeOne(
portal_type='Sale Invoice Transaction', portal_type='Sale Invoice Transaction',
title='Transaction 2', title='Transaction 2',
reference='ref2',
source_reference='2', source_reference='2',
destination_section_value=self.organisation_module.client_1, destination_section_value=self.organisation_module.client_1,
start_date=DateTime(2006, 2, 2), start_date=DateTime(2006, 2, 2),
...@@ -1374,6 +1357,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -1374,6 +1357,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
t3 = self._makeOne( t3 = self._makeOne(
portal_type='Payment Transaction', portal_type='Payment Transaction',
title='Transaction 3', title='Transaction 3',
reference='ref3',
source_reference='3', source_reference='3',
simulation_state='delivered', simulation_state='delivered',
causality_value=t2, causality_value=t2,
...@@ -1393,6 +1377,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -1393,6 +1377,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
t4 = self._makeOne( t4 = self._makeOne(
portal_type='Sale Invoice Transaction', portal_type='Sale Invoice Transaction',
title='Transaction 4', title='Transaction 4',
reference='ref4',
source_reference='4', source_reference='4',
destination_section_value=self.organisation_module.client_1, destination_section_value=self.organisation_module.client_1,
start_date=DateTime(2006, 3, 1), start_date=DateTime(2006, 3, 1),
...@@ -1420,6 +1405,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -1420,6 +1405,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
request_form['simulation_state'] = ['delivered'] request_form['simulation_state'] = ['delivered']
request_form['detailed_from_date_summary'] = 1 request_form['detailed_from_date_summary'] = 1
request_form['hide_analytic'] = False request_form['hide_analytic'] = False
request_form['export'] = False
report_section_list = self.getReportSectionList( report_section_list = self.getReportSectionList(
self.portal.accounting_module, self.portal.accounting_module,
...@@ -1437,19 +1423,17 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -1437,19 +1423,17 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
# We only have line for transactions 1 and 2 which are not grouped # We only have line for transactions 1 and 2 which are not grouped
self.assertEqual(2, len(data_line_list)) self.assertEqual(2, len(data_line_list))
self.checkLineProperties(data_line_list[0], self.checkLineProperties(data_line_list[0],
Movement_getSpecificReference='1', Movement_getSpecificReference='1',
date=DateTime(2006, 2, 1), date=DateTime(2006, 2, 1),
Movement_getExplanationTitle='Transaction 1', Movement_getExplanationTitleAndAnalytics='Transaction 1\nref1',
Movement_getMirrorSectionTitle='Client 1', debit_price=100,
debit_price=100, credit_price=0,)
credit_price=0,)
self.checkLineProperties(data_line_list[1], self.checkLineProperties(data_line_list[1],
Movement_getSpecificReference='2', Movement_getSpecificReference='2',
date=DateTime(2006, 2, 2), date=DateTime(2006, 2, 2),
Movement_getExplanationTitle='Transaction 2', Movement_getExplanationTitleAndAnalytics='Transaction 2\nref2',
Movement_getMirrorSectionTitle='Client 1', debit_price=200,
debit_price=200, credit_price=0,)
credit_price=0,)
self.assertTrue(line_list[-1].isStatLine()) self.assertTrue(line_list[-1].isStatLine())
self.checkLineProperties(line_list[-1], debit_price=300, credit_price=0) self.checkLineProperties(line_list[-1], debit_price=300, credit_price=0)
...@@ -1459,29 +1443,26 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -1459,29 +1443,26 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
data_line_list = [l for l in line_list if l.isDataLine()] data_line_list = [l for l in line_list if l.isDataLine()]
self.assertEqual(3, len(data_line_list)) self.assertEqual(3, len(data_line_list))
self.checkLineProperties(data_line_list[0], self.checkLineProperties(data_line_list[0],
Movement_getSpecificReference='Previous Balance', Movement_getSpecificReference='Previous Balance',
date=DateTime(2006, 2, 25), date=DateTime(2006, 2, 25),
Movement_getExplanationTitle='', Movement_getExplanationTitleAndAnalytics=None,
Movement_getMirrorSectionTitle='', running_total_price=300,
running_total_price=300, debit_price=300,
debit_price=300, credit_price=0,)
credit_price=0,)
self.checkLineProperties(data_line_list[1], self.checkLineProperties(data_line_list[1],
Movement_getSpecificReference='3', Movement_getSpecificReference='3',
date=DateTime(2006, 2, 25, 2, 3), date=DateTime(2006, 2, 25, 2, 3),
Movement_getExplanationTitle='Transaction 3', Movement_getExplanationTitleAndAnalytics='Transaction 3\nref3',
Movement_getMirrorSectionTitle='Client 1', running_total_price=100,
running_total_price=100, debit_price=0,
debit_price=0, credit_price=200,)
credit_price=200,)
self.checkLineProperties(data_line_list[2], self.checkLineProperties(data_line_list[2],
Movement_getSpecificReference='4', Movement_getSpecificReference='4',
date=DateTime(2006, 3, 1), date=DateTime(2006, 3, 1),
Movement_getExplanationTitle='Transaction 4', Movement_getExplanationTitleAndAnalytics='Transaction 4\nref4',
Movement_getMirrorSectionTitle='Client 1', running_total_price=500,
running_total_price=500, debit_price=400,
debit_price=400, credit_price=0,)
credit_price=0,)
self.assertTrue(line_list[-1].isStatLine()) self.assertTrue(line_list[-1].isStatLine())
self.checkLineProperties(line_list[-1], debit_price=700, credit_price=200) self.checkLineProperties(line_list[-1], debit_price=700, credit_price=200)
...@@ -1500,6 +1481,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -1500,6 +1481,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
request_form['simulation_state'] = ['delivered'] request_form['simulation_state'] = ['delivered']
request_form['detailed_from_date_summary'] = 1 request_form['detailed_from_date_summary'] = 1
request_form['hide_analytic'] = False request_form['hide_analytic'] = False
request_form['export'] = False
report_section_list = self.getReportSectionList( report_section_list = self.getReportSectionList(
self.portal.accounting_module, self.portal.accounting_module,
...@@ -1517,12 +1499,11 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -1517,12 +1499,11 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
# We only have line for transaction 1 which are not grouped # We only have line for transaction 1 which are not grouped
self.assertEqual(1, len(data_line_list)) self.assertEqual(1, len(data_line_list))
self.checkLineProperties(data_line_list[0], self.checkLineProperties(data_line_list[0],
Movement_getSpecificReference='1', Movement_getSpecificReference='1',
date=DateTime(2006, 2, 1), date=DateTime(2006, 2, 1),
Movement_getExplanationTitle='Transaction 1', Movement_getExplanationTitleAndAnalytics='Transaction 1\nref1',
Movement_getMirrorSectionTitle='Client 1', debit_price=100,
debit_price=100, credit_price=0,)
credit_price=0,)
self.assertTrue(line_list[-1].isStatLine()) self.assertTrue(line_list[-1].isStatLine())
self.checkLineProperties(line_list[-1], debit_price=100, credit_price=0) self.checkLineProperties(line_list[-1], debit_price=100, credit_price=0)
...@@ -1532,21 +1513,18 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -1532,21 +1513,18 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
data_line_list = [l for l in line_list if l.isDataLine()] data_line_list = [l for l in line_list if l.isDataLine()]
self.assertEqual(2, len(data_line_list)) self.assertEqual(2, len(data_line_list))
self.checkLineProperties(data_line_list[0], self.checkLineProperties(data_line_list[0],
Movement_getSpecificReference='Previous Balance', Movement_getSpecificReference='Previous Balance',
date=DateTime(2006, 2, 26), date=DateTime(2006, 2, 26),
Movement_getExplanationTitle='', running_total_price=100,
Movement_getMirrorSectionTitle='', debit_price=300,
running_total_price=100, credit_price=200,)
debit_price=300,
credit_price=200,)
self.checkLineProperties(data_line_list[1], self.checkLineProperties(data_line_list[1],
Movement_getSpecificReference='4', Movement_getSpecificReference='4',
date=DateTime(2006, 3, 1), date=DateTime(2006, 3, 1),
Movement_getExplanationTitle='Transaction 4', Movement_getExplanationTitleAndAnalytics='Transaction 4\nref4',
Movement_getMirrorSectionTitle='Client 1', running_total_price=500,
running_total_price=500, debit_price=400,
debit_price=400, credit_price=0,)
credit_price=0,)
self.assertTrue(line_list[-1].isStatLine()) self.assertTrue(line_list[-1].isStatLine())
self.checkLineProperties(line_list[-1], debit_price=700, credit_price=200) self.checkLineProperties(line_list[-1], debit_price=700, credit_price=200)
...@@ -1566,6 +1544,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -1566,6 +1544,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
request_form['section_category_strict'] = False request_form['section_category_strict'] = False
request_form['simulation_state'] = ['delivered'] request_form['simulation_state'] = ['delivered']
request_form['hide_analytic'] = False request_form['hide_analytic'] = False
request_form['export'] = False
report_section_list = self.getReportSectionList( report_section_list = self.getReportSectionList(
self.portal.accounting_module, self.portal.accounting_module,
...@@ -1578,22 +1557,20 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -1578,22 +1557,20 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
self.assertEqual(2, len(data_line_list)) self.assertEqual(2, len(data_line_list))
self.checkLineProperties(data_line_list[0], self.checkLineProperties(data_line_list[0],
Movement_getSpecificReference='2', Movement_getSpecificReference='2',
date=DateTime(2006, 1, 1), date=DateTime(2006, 1, 1),
Movement_getExplanationTitle='Transaction 2', Movement_getExplanationTitleAndAnalytics='Transaction 2\nref2',
Movement_getMirrorSectionTitle='Client 1', debit_price=0,
debit_price=0, credit_price=200,
credit_price=200, running_total_price=-200)
running_total_price=-200)
self.checkLineProperties(data_line_list[1], self.checkLineProperties(data_line_list[1],
Movement_getSpecificReference='3', Movement_getSpecificReference='3',
date=DateTime(2006, 2, 2), date=DateTime(2006, 2, 2),
Movement_getExplanationTitle='Transaction 3', Movement_getExplanationTitleAndAnalytics='Transaction 3\nref3',
Movement_getMirrorSectionTitle='Client 1', debit_price=0,
debit_price=0, credit_price=300,
credit_price=300, running_total_price=-500)
running_total_price=-500)
self.assertTrue(line_list[-1].isStatLine()) self.assertTrue(line_list[-1].isStatLine())
self.checkLineProperties(line_list[-1], debit_price=0, credit_price=500) self.checkLineProperties(line_list[-1], debit_price=0, credit_price=500)
...@@ -1609,6 +1586,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -1609,6 +1586,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
t1b = self._makeOne( t1b = self._makeOne(
portal_type='Sale Invoice Transaction', portal_type='Sale Invoice Transaction',
title='Transaction 1b', title='Transaction 1b',
reference='ref1b',
source_reference='1b', source_reference='1b',
simulation_state='delivered', simulation_state='delivered',
destination_section_value=self.organisation_module.client_1, destination_section_value=self.organisation_module.client_1,
...@@ -1629,6 +1607,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -1629,6 +1607,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
request_form['section_category_strict'] = False request_form['section_category_strict'] = False
request_form['simulation_state'] = ['delivered'] request_form['simulation_state'] = ['delivered']
request_form['hide_analytic'] = False request_form['hide_analytic'] = False
request_form['export'] = False
report_section_list = self.getReportSectionList( report_section_list = self.getReportSectionList(
self.portal.accounting_module, self.portal.accounting_module,
...@@ -1639,22 +1618,20 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -1639,22 +1618,20 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
data_line_list = [l for l in line_list if l.isDataLine()] data_line_list = [l for l in line_list if l.isDataLine()]
self.assertEqual(2, len(data_line_list)) self.assertEqual(2, len(data_line_list))
self.checkLineProperties(data_line_list[0], self.checkLineProperties(data_line_list[0],
Movement_getSpecificReference='Previous Balance', Movement_getSpecificReference='Previous Balance',
date=DateTime(2006, 2, 2), date=DateTime(2006, 2, 2),
Movement_getExplanationTitle='', Movement_getExplanationTitleAndAnalytics=None,
Movement_getMirrorSectionTitle='', debit_price=300,
debit_price=300, credit_price=21,
credit_price=21, running_total_price=279)
running_total_price=279)
self.checkLineProperties(data_line_list[1], self.checkLineProperties(data_line_list[1],
Movement_getSpecificReference='3', Movement_getSpecificReference='3',
date=DateTime(2006, 2, 2), date=DateTime(2006, 2, 2),
Movement_getExplanationTitle='Transaction 3', Movement_getExplanationTitleAndAnalytics='Transaction 3\nref3',
Movement_getMirrorSectionTitle='Client 1', debit_price=300,
debit_price=300, credit_price=0,
credit_price=0, running_total_price=579)
running_total_price=579)
self.assertTrue(line_list[-1].isStatLine()) self.assertTrue(line_list[-1].isStatLine())
self.checkLineProperties(line_list[-1], debit_price=600, credit_price=21) self.checkLineProperties(line_list[-1], debit_price=600, credit_price=21)
...@@ -1671,6 +1648,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -1671,6 +1648,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
t1b = self._makeOne( t1b = self._makeOne(
portal_type='Sale Invoice Transaction', portal_type='Sale Invoice Transaction',
title='Transaction 1b', title='Transaction 1b',
reference='ref1b',
source_reference='1b', source_reference='1b',
simulation_state='delivered', simulation_state='delivered',
destination_section_value=self.organisation_module.client_1, destination_section_value=self.organisation_module.client_1,
...@@ -1690,6 +1668,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -1690,6 +1668,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
request_form['section_category_strict'] = False request_form['section_category_strict'] = False
request_form['simulation_state'] = ['delivered'] request_form['simulation_state'] = ['delivered']
request_form['hide_analytic'] = False request_form['hide_analytic'] = False
request_form['export'] = False
report_section_list = self.getReportSectionList( report_section_list = self.getReportSectionList(
self.portal.accounting_module, self.portal.accounting_module,
...@@ -1701,31 +1680,28 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -1701,31 +1680,28 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
self.assertEqual(3, len(data_line_list)) self.assertEqual(3, len(data_line_list))
self.checkLineProperties(data_line_list[0], self.checkLineProperties(data_line_list[0],
Movement_getSpecificReference='Previous Balance', Movement_getSpecificReference='Previous Balance',
date=DateTime(2006, 1, 1), date=DateTime(2006, 1, 1),
Movement_getExplanationTitle='', Movement_getExplanationTitleAndAnalytics=None,
Movement_getMirrorSectionTitle='', debit_price=79,
debit_price=79, credit_price=0,
credit_price=0, running_total_price=79)
running_total_price=79)
self.checkLineProperties(data_line_list[1], self.checkLineProperties(data_line_list[1],
Movement_getSpecificReference='2', Movement_getSpecificReference='2',
date=DateTime(2006, 1, 1), date=DateTime(2006, 1, 1),
Movement_getExplanationTitle='Transaction 2', Movement_getExplanationTitleAndAnalytics='Transaction 2\nref2',
Movement_getMirrorSectionTitle='Client 1', debit_price=200,
debit_price=200, credit_price=0,
credit_price=0, running_total_price=279)
running_total_price=279)
self.checkLineProperties(data_line_list[2], self.checkLineProperties(data_line_list[2],
Movement_getSpecificReference='3', Movement_getSpecificReference='3',
date=DateTime(2006, 2, 2), date=DateTime(2006, 2, 2),
Movement_getExplanationTitle='Transaction 3', Movement_getExplanationTitleAndAnalytics='Transaction 3\nref3',
Movement_getMirrorSectionTitle='Client 1', debit_price=300,
debit_price=300, credit_price=0,
credit_price=0, running_total_price=579)
running_total_price=579)
self.assertTrue(line_list[-1].isStatLine()) self.assertTrue(line_list[-1].isStatLine())
self.checkLineProperties(line_list[-1], debit_price=579, credit_price=0) self.checkLineProperties(line_list[-1], debit_price=579, credit_price=0)
...@@ -1746,6 +1722,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -1746,6 +1722,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
request_form['section_category_strict'] = False request_form['section_category_strict'] = False
request_form['simulation_state'] = ['delivered'] request_form['simulation_state'] = ['delivered']
request_form['hide_analytic'] = False request_form['hide_analytic'] = False
request_form['export'] = False
report_section_list = self.getReportSectionList( report_section_list = self.getReportSectionList(
self.portal.accounting_module, self.portal.accounting_module,
...@@ -1756,22 +1733,19 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -1756,22 +1733,19 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
data_line_list = [l for l in line_list if l.isDataLine()] data_line_list = [l for l in line_list if l.isDataLine()]
self.assertEqual(2, len(data_line_list)) self.assertEqual(2, len(data_line_list))
self.checkLineProperties(data_line_list[0], self.checkLineProperties(data_line_list[0],
Movement_getSpecificReference='Previous Balance', Movement_getSpecificReference='Previous Balance',
date=DateTime(2006, 2, 2), date=DateTime(2006, 2, 2),
Movement_getExplanationTitle='', debit_price=0,
Movement_getMirrorSectionTitle='', credit_price=200,
debit_price=0, running_total_price=-200)
credit_price=200,
running_total_price=-200)
self.checkLineProperties(data_line_list[1], self.checkLineProperties(data_line_list[1],
Movement_getSpecificReference='3', Movement_getSpecificReference='3',
date=DateTime(2006, 2, 2), date=DateTime(2006, 2, 2),
Movement_getExplanationTitle='Transaction 3', Movement_getExplanationTitleAndAnalytics='Transaction 3\nref3',
Movement_getMirrorSectionTitle='Client 1', debit_price=0,
debit_price=0, credit_price=300,
credit_price=300, running_total_price=-500)
running_total_price=-500)
self.assertTrue(line_list[-1].isStatLine()) self.assertTrue(line_list[-1].isStatLine())
self.checkLineProperties(line_list[-1], debit_price=0, credit_price=500) self.checkLineProperties(line_list[-1], debit_price=0, credit_price=500)
...@@ -1792,6 +1766,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -1792,6 +1766,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
request_form['section_category_strict'] = False request_form['section_category_strict'] = False
request_form['simulation_state'] = ['delivered'] request_form['simulation_state'] = ['delivered']
request_form['hide_analytic'] = False request_form['hide_analytic'] = False
request_form['export'] = False
report_section_list = self.getReportSectionList( report_section_list = self.getReportSectionList(
self.portal.accounting_module, self.portal.accounting_module,
...@@ -1802,31 +1777,28 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -1802,31 +1777,28 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
data_line_list = [l for l in line_list if l.isDataLine()] data_line_list = [l for l in line_list if l.isDataLine()]
self.assertEqual(3, len(data_line_list)) self.assertEqual(3, len(data_line_list))
self.checkLineProperties(data_line_list[0], self.checkLineProperties(data_line_list[0],
Movement_getSpecificReference='1', Movement_getSpecificReference='1',
date=DateTime(2005, 12, 31), date=DateTime(2005, 12, 31),
Movement_getExplanationTitle='Transaction 1', Movement_getExplanationTitleAndAnalytics='Transaction 1\nref1',
Movement_getMirrorSectionTitle='Client 1', debit_price=0,
debit_price=0, credit_price=100,
credit_price=100, running_total_price=-100)
running_total_price=-100)
self.checkLineProperties(data_line_list[1], self.checkLineProperties(data_line_list[1],
Movement_getSpecificReference='2', Movement_getSpecificReference='2',
date=DateTime(2006, 1, 1), date=DateTime(2006, 1, 1),
Movement_getExplanationTitle='Transaction 2', Movement_getExplanationTitleAndAnalytics='Transaction 2\nref2',
Movement_getMirrorSectionTitle='Client 1', debit_price=0,
debit_price=0, credit_price=200,
credit_price=200, running_total_price=-300)
running_total_price=-300)
self.checkLineProperties(data_line_list[2], self.checkLineProperties(data_line_list[2],
Movement_getSpecificReference='3', Movement_getSpecificReference='3',
date=DateTime(2006, 2, 2), date=DateTime(2006, 2, 2),
Movement_getExplanationTitle='Transaction 3', Movement_getExplanationTitleAndAnalytics='Transaction 3\nref3',
Movement_getMirrorSectionTitle='Client 1', debit_price=0,
debit_price=0, credit_price=300,
credit_price=300, running_total_price=-600)
running_total_price=-600)
self.assertTrue(line_list[-1].isStatLine()) self.assertTrue(line_list[-1].isStatLine())
self.checkLineProperties(line_list[-1], debit_price=0, credit_price=600) self.checkLineProperties(line_list[-1], debit_price=0, credit_price=600)
...@@ -1848,6 +1820,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -1848,6 +1820,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
request_form['section_category_strict'] = False request_form['section_category_strict'] = False
request_form['simulation_state'] = ['delivered'] request_form['simulation_state'] = ['delivered']
request_form['hide_analytic'] = False request_form['hide_analytic'] = False
request_form['export'] = False
report_section_list = self.getReportSectionList( report_section_list = self.getReportSectionList(
self.portal.accounting_module, self.portal.accounting_module,
...@@ -1858,20 +1831,13 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -1858,20 +1831,13 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
self.assertEqual(1, len(data_line_list)) self.assertEqual(1, len(data_line_list))
line = data_line_list[0] line = data_line_list[0]
# mirror section title is not in the list of columns, as a mirror section
# is choosen in the dialog
self.assertEqual(line.column_id_list,
['Movement_getSpecificReference', 'date',
'Movement_getExplanationTitle', 'Movement_getExplanationReference',
'debit_price', 'credit_price', 'running_total_price'])
self.checkLineProperties(data_line_list[0], self.checkLineProperties(data_line_list[0],
Movement_getSpecificReference='4', Movement_getSpecificReference='4',
date=DateTime(2006, 2, 2, 0, 3), date=DateTime(2006, 2, 2, 0, 3),
Movement_getExplanationTitle='Transaction 4', Movement_getExplanationTitleAndAnalytics='Transaction 4\nref4',
debit_price=400, debit_price=400,
credit_price=0, credit_price=0,
running_total_price=400) running_total_price=400)
self.assertTrue(line_list[-1].isStatLine()) self.assertTrue(line_list[-1].isStatLine())
self.checkLineProperties(line_list[-1], debit_price=400, credit_price=0) self.checkLineProperties(line_list[-1], debit_price=400, credit_price=0)
...@@ -1890,6 +1856,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -1890,6 +1856,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
request_form['section_category_strict'] = False request_form['section_category_strict'] = False
request_form['simulation_state'] = ['stopped', 'confirmed'] request_form['simulation_state'] = ['stopped', 'confirmed']
request_form['hide_analytic'] = False request_form['hide_analytic'] = False
request_form['export'] = False
report_section_list = self.getReportSectionList( report_section_list = self.getReportSectionList(
self.portal.accounting_module, self.portal.accounting_module,
...@@ -1900,13 +1867,12 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -1900,13 +1867,12 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
self.assertEqual(1, len(data_line_list)) self.assertEqual(1, len(data_line_list))
self.checkLineProperties(data_line_list[0], self.checkLineProperties(data_line_list[0],
Movement_getSpecificReference='7', Movement_getSpecificReference='7',
date=DateTime(2006, 2, 2, 0, 6), date=DateTime(2006, 2, 2, 0, 6),
Movement_getExplanationTitle='Transaction 7', Movement_getExplanationTitleAndAnalytics='Transaction 7\nref7',
Movement_getMirrorSectionTitle='Client 1', debit_price=700,
debit_price=700, credit_price=0,
credit_price=0, running_total_price=700)
running_total_price=700)
self.assertTrue(line_list[-1].isStatLine()) self.assertTrue(line_list[-1].isStatLine())
self.checkLineProperties(line_list[-1], debit_price=700, credit_price=0) self.checkLineProperties(line_list[-1], debit_price=700, credit_price=0)
...@@ -1951,6 +1917,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -1951,6 +1917,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
request_form['section_category_strict'] = False request_form['section_category_strict'] = False
request_form['simulation_state'] = ['delivered'] request_form['simulation_state'] = ['delivered']
request_form['hide_analytic'] = False request_form['hide_analytic'] = False
request_form['export'] = False
report_section_list = self.getReportSectionList( report_section_list = self.getReportSectionList(
self.portal.accounting_module, self.portal.accounting_module,
...@@ -1961,22 +1928,18 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -1961,22 +1928,18 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
self.assertEqual(2, len(data_line_list)) self.assertEqual(2, len(data_line_list))
self.checkLineProperties(data_line_list[0], self.checkLineProperties(data_line_list[0],
Movement_getSpecificReference='1', Movement_getSpecificReference='1',
date=DateTime(2006, 2, 1, 0, 1), date=DateTime(2006, 2, 1, 0, 1),
Movement_getExplanationTitle='Transaction 1', debit_price=-100,
Movement_getMirrorSectionTitle='Client 1', credit_price=0,
debit_price=-100, running_total_price=-100)
credit_price=0,
running_total_price=-100)
self.checkLineProperties(data_line_list[1], self.checkLineProperties(data_line_list[1],
Movement_getSpecificReference='2', Movement_getSpecificReference='2',
date=DateTime(2006, 2, 1, 0, 2), date=DateTime(2006, 2, 1, 0, 2),
Movement_getExplanationTitle='Transaction 2', debit_price=0,
Movement_getMirrorSectionTitle='Client 1', credit_price=-200,
debit_price=0, running_total_price=100)
credit_price=-200,
running_total_price=100)
self.assertTrue(line_list[-1].isStatLine()) self.assertTrue(line_list[-1].isStatLine())
self.checkLineProperties(line_list[-1], debit_price=-100, credit_price=-200,) self.checkLineProperties(line_list[-1], debit_price=-100, credit_price=-200,)
...@@ -2011,6 +1974,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -2011,6 +1974,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
request_form['section_category_strict'] = False request_form['section_category_strict'] = False
request_form['simulation_state'] = ['delivered'] request_form['simulation_state'] = ['delivered']
request_form['hide_analytic'] = False request_form['hide_analytic'] = False
request_form['export'] = False
report_section_list = self.getReportSectionList( report_section_list = self.getReportSectionList(
self.portal.accounting_module, self.portal.accounting_module,
...@@ -2030,16 +1994,12 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -2030,16 +1994,12 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
self.checkLineProperties(line, self.checkLineProperties(line,
Movement_getSpecificReference='Source Reference', Movement_getSpecificReference='Source Reference',
date=DateTime(2006, 2, 1), date=DateTime(2006, 2, 1),
Movement_getExplanationTitle='Transaction 1',
Movement_getMirrorSectionTitle=self.section.getTitle(),
debit_price=0, debit_price=0,
credit_price=100,) credit_price=100,)
else: else:
self.checkLineProperties(line, self.checkLineProperties(line,
Movement_getSpecificReference='Destination Reference', Movement_getSpecificReference='Destination Reference',
date=DateTime(2006, 2, 1), date=DateTime(2006, 2, 1),
Movement_getExplanationTitle='Transaction 1',
Movement_getMirrorSectionTitle=self.section.getTitle(),
debit_price=100, debit_price=100,
credit_price=0,) credit_price=0,)
...@@ -2054,6 +2014,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -2054,6 +2014,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
t1 = self._makeOne( t1 = self._makeOne(
portal_type='Accounting Transaction', portal_type='Accounting Transaction',
title='Transaction 1', title='Transaction 1',
reference='ref1',
source_reference='1', source_reference='1',
simulation_state='delivered', simulation_state='delivered',
destination_section_value=self.organisation_module.client_1, destination_section_value=self.organisation_module.client_1,
...@@ -2066,6 +2027,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -2066,6 +2027,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
t2 = self._makeOne( t2 = self._makeOne(
portal_type='Accounting Transaction', portal_type='Accounting Transaction',
title='Transaction 2', title='Transaction 2',
reference='ref2',
source_reference='2', source_reference='2',
source_section_value=self.main_section, source_section_value=self.main_section,
simulation_state='delivered', simulation_state='delivered',
...@@ -2085,6 +2047,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -2085,6 +2047,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
request_form['section_category_strict'] = False request_form['section_category_strict'] = False
request_form['simulation_state'] = ['delivered'] request_form['simulation_state'] = ['delivered']
request_form['hide_analytic'] = False request_form['hide_analytic'] = False
request_form['export'] = False
report_section_list = self.getReportSectionList( report_section_list = self.getReportSectionList(
self.portal.accounting_module, self.portal.accounting_module,
...@@ -2094,32 +2057,23 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -2094,32 +2057,23 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
data_line_list = [l for l in line_list if l.isDataLine()] data_line_list = [l for l in line_list if l.isDataLine()]
self.assertEqual(2, len(data_line_list)) self.assertEqual(2, len(data_line_list))
self.assertEqual(data_line_list[0].column_id_list,
['Movement_getSpecificReference', 'date',
'Movement_getExplanationTitle', 'section_title',
'Movement_getMirrorSectionTitle',
'Movement_getExplanationReference',
'debit_price', 'credit_price', 'running_total_price'])
self.checkLineProperties(data_line_list[0], self.checkLineProperties(data_line_list[0],
Movement_getSpecificReference='1', Movement_getSpecificReference='1',
date=DateTime(2006, 2, 1), date=DateTime(2006, 2, 1),
section_title='My Organisation', section_title='My Organisation',
Movement_getExplanationTitle='Transaction 1', Movement_getExplanationTitleAndAnalytics='Transaction 1\nref1',
Movement_getMirrorSectionTitle='Client 1', debit_price=100,
debit_price=100, credit_price=0,
credit_price=0, running_total_price=100)
running_total_price=100)
self.checkLineProperties(data_line_list[1], self.checkLineProperties(data_line_list[1],
Movement_getSpecificReference='2', Movement_getSpecificReference='2',
date=DateTime(2006, 2, 1, 0, 1), date=DateTime(2006, 2, 1, 0, 1),
section_title='My Master Organisation', section_title='My Master Organisation',
Movement_getExplanationTitle='Transaction 2', Movement_getExplanationTitleAndAnalytics='Transaction 2\nref2',
Movement_getMirrorSectionTitle='Client 1', debit_price=0,
debit_price=0, credit_price=200,
credit_price=200, running_total_price=-100)
running_total_price=-100)
self.assertTrue(line_list[-1].isStatLine()) self.assertTrue(line_list[-1].isStatLine())
self.checkLineProperties(line_list[-1], debit_price=100, credit_price=200) self.checkLineProperties(line_list[-1], debit_price=100, credit_price=200)
...@@ -2138,6 +2092,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -2138,6 +2092,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
request_form['simulation_state'] = ['delivered'] request_form['simulation_state'] = ['delivered']
request_form['project'] = self.project_1.getRelativeUrl() request_form['project'] = self.project_1.getRelativeUrl()
request_form['hide_analytic'] = False request_form['hide_analytic'] = False
request_form['export'] = False
report_section_list = self.getReportSectionList( report_section_list = self.getReportSectionList(
self.portal.accounting_module, self.portal.accounting_module,
...@@ -2149,9 +2104,9 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -2149,9 +2104,9 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
self.assertEqual(1, len(data_line_list)) self.assertEqual(1, len(data_line_list))
self.checkLineProperties(data_line_list[0], self.checkLineProperties(data_line_list[0],
Movement_getSpecificReference='1', Movement_getSpecificReference='1',
Movement_getExplanationTitle='Function a Project 1', Movement_getExplanationTitleAndAnalytics=
'Function a Project 1\nFaP1',
date=DateTime(2006, 2, 2), date=DateTime(2006, 2, 2),
Movement_getMirrorSectionTitle='Client 1',
debit_price=500, credit_price=0, running_total_price=500, ) debit_price=500, credit_price=0, running_total_price=500, )
self.assertTrue(line_list[-1].isStatLine()) self.assertTrue(line_list[-1].isStatLine())
self.checkLineProperties(line_list[-1], debit_price=500, credit_price=0) self.checkLineProperties(line_list[-1], debit_price=500, credit_price=0)
...@@ -2171,6 +2126,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -2171,6 +2126,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
request_form['simulation_state'] = ['delivered'] request_form['simulation_state'] = ['delivered']
request_form['project'] = 'None' request_form['project'] = 'None'
request_form['hide_analytic'] = False request_form['hide_analytic'] = False
request_form['export'] = False
report_section_list = self.getReportSectionList( report_section_list = self.getReportSectionList(
self.portal.accounting_module, self.portal.accounting_module,
...@@ -2182,9 +2138,9 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -2182,9 +2138,9 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
self.assertEqual(1, len(data_line_list)) self.assertEqual(1, len(data_line_list))
self.checkLineProperties(data_line_list[0], self.checkLineProperties(data_line_list[0],
Movement_getSpecificReference='3', Movement_getSpecificReference='3',
Movement_getExplanationTitle='No function no project', Movement_getExplanationTitleAndAnalytics=
'No function no project\nnono',
date=DateTime(2006, 2, 2), date=DateTime(2006, 2, 2),
Movement_getMirrorSectionTitle='Client 1',
debit_price=700, credit_price=0, running_total_price=700, ) debit_price=700, credit_price=0, running_total_price=700, )
self.assertTrue(line_list[-1].isStatLine()) self.assertTrue(line_list[-1].isStatLine())
self.checkLineProperties(line_list[-1], debit_price=700, credit_price=0) self.checkLineProperties(line_list[-1], debit_price=700, credit_price=0)
...@@ -4342,6 +4298,7 @@ class TestAccountingReportsWithAnalytic(AccountingTestCase, ERP5ReportTestCase): ...@@ -4342,6 +4298,7 @@ class TestAccountingReportsWithAnalytic(AccountingTestCase, ERP5ReportTestCase):
request_form['section_category_strict'] = False request_form['section_category_strict'] = False
request_form['simulation_state'] = ['delivered'] request_form['simulation_state'] = ['delivered']
request_form['hide_analytic'] = False request_form['hide_analytic'] = False
request_form['export'] = False
report_section_list = self.getReportSectionList( report_section_list = self.getReportSectionList(
self.portal.accounting_module, self.portal.accounting_module,
...@@ -4352,36 +4309,24 @@ class TestAccountingReportsWithAnalytic(AccountingTestCase, ERP5ReportTestCase): ...@@ -4352,36 +4309,24 @@ class TestAccountingReportsWithAnalytic(AccountingTestCase, ERP5ReportTestCase):
data_line_list = [l for l in line_list if l.isDataLine()] data_line_list = [l for l in line_list if l.isDataLine()]
self.assertEqual(3, len(data_line_list)) self.assertEqual(3, len(data_line_list))
line = data_line_list[0]
self.assertEqual(line.column_id_list,
['Movement_getSpecificReference', 'date',
'Movement_getExplanationTitle',
'function', 'project', 'product_line_translated_title',
'Movement_getMirrorSectionTitle',
'Movement_getExplanationReference',
'debit_price', 'credit_price', 'running_total_price'])
self.checkLineProperties(data_line_list[0], self.checkLineProperties(data_line_list[0],
project='P1 - Project 1', Movement_getExplanationTitleAndAnalytics='''Detailed Transaction
function='a', DT, a, P1 - Project 1, pl1''',
product_line_translated_title='pl1', debit_price=0,
debit_price=0, credit_price=300,
credit_price=300, running_total_price=-300)
running_total_price=-300)
self.checkLineProperties(data_line_list[1], self.checkLineProperties(data_line_list[1],
project='P1 - Project 1', Movement_getExplanationTitleAndAnalytics='''Detailed Transaction
function='b', DT, b, P1 - Project 1, pl1''',
product_line_translated_title='pl1', debit_price=0,
debit_price=0, credit_price=500,
credit_price=500, running_total_price=-800)
running_total_price=-800)
self.checkLineProperties(data_line_list[2], self.checkLineProperties(data_line_list[2],
project='P2 - Project 2', Movement_getExplanationTitleAndAnalytics='''Detailed Transaction
function='b', DT, b, P2 - Project 2''',
product_line_translated_title=None, debit_price=0,
debit_price=0, credit_price=700,
credit_price=700, running_total_price=-1500)
running_total_price=-1500)
stat_line = line_list[-1] stat_line = line_list[-1]
self.assertTrue(line_list[-1].isStatLine()) self.assertTrue(line_list[-1].isStatLine())
...@@ -4396,6 +4341,7 @@ class TestAccountingReportsWithAnalytic(AccountingTestCase, ERP5ReportTestCase): ...@@ -4396,6 +4341,7 @@ class TestAccountingReportsWithAnalytic(AccountingTestCase, ERP5ReportTestCase):
request_form['section_category_strict'] = False request_form['section_category_strict'] = False
request_form['simulation_state'] = ['delivered'] request_form['simulation_state'] = ['delivered']
request_form['hide_analytic'] = True request_form['hide_analytic'] = True
request_form['export'] = False
report_section_list = self.getReportSectionList( report_section_list = self.getReportSectionList(
self.portal.accounting_module, self.portal.accounting_module,
...@@ -4406,14 +4352,6 @@ class TestAccountingReportsWithAnalytic(AccountingTestCase, ERP5ReportTestCase): ...@@ -4406,14 +4352,6 @@ class TestAccountingReportsWithAnalytic(AccountingTestCase, ERP5ReportTestCase):
data_line_list = [l for l in line_list if l.isDataLine()] data_line_list = [l for l in line_list if l.isDataLine()]
self.assertEqual(1, len(data_line_list)) self.assertEqual(1, len(data_line_list))
line = data_line_list[0]
self.assertEqual(line.column_id_list,
['Movement_getSpecificReference', 'date',
'Movement_getExplanationTitle',
'Movement_getMirrorSectionTitle',
'Movement_getExplanationReference',
'debit_price', 'credit_price', 'running_total_price'])
self.checkLineProperties(data_line_list[0], self.checkLineProperties(data_line_list[0],
debit_price=0, debit_price=0,
credit_price=1500, credit_price=1500,
...@@ -4423,6 +4361,121 @@ class TestAccountingReportsWithAnalytic(AccountingTestCase, ERP5ReportTestCase): ...@@ -4423,6 +4361,121 @@ class TestAccountingReportsWithAnalytic(AccountingTestCase, ERP5ReportTestCase):
self.assertTrue(line_list[-1].isStatLine()) self.assertTrue(line_list[-1].isStatLine())
self.checkLineProperties(line_list[-1], debit_price=0, credit_price=1500) self.checkLineProperties(line_list[-1], debit_price=0, credit_price=1500)
def testAccountStatementAnalyticsExport(self):
request_form = self.portal.REQUEST.form
request_form['node'] = \
self.portal.account_module.goods_sales.getRelativeUrl()
request_form['at_date'] = DateTime(2006, 2, 2)
request_form['section_category'] = 'group/demo_group/sub1'
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_viewAccountStatementReport')
self.assertEqual(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.assertEqual(3, len(data_line_list))
self.assertEqual(
['Movement_getNodeGapId', 'node_translated_title', 'section_title',
'mirror_section_title', 'date', 'modification_date',
'Movement_getSpecificReference',
'Movement_getExplanationTranslatedPortalType',
'Movement_getExplanationTitle', 'Movement_getExplanationReference',
# those are analytics columns
'function', 'product_line_translated_title',
'debit_price', 'credit_price',
'total_price', 'Movement_getSectionPriceCurrency', 'debit', 'credit',
'total_quantity', 'resource_reference', 'Movement_getPaymentTitle',
'payment_mode_translated_title', 'grouping_reference', 'grouping_date',
'getTranslatedSimulationStateTitle'],
data_line_list[0].column_id_list)
self.checkLineProperties(data_line_list[0],
Movement_getNodeGapId='7',
node_translated_title='Goods Sales',
section_title='My Organisation',
mirror_section_title='Client 1',
date=DateTime(2006, 2, 2),
Movement_getSpecificReference='1',
Movement_getExplanationTranslatedPortalType=
'Sale Invoice Transaction',
Movement_getExplanationTitle='Detailed Transaction',
Movement_getExplanationReference='DT',
function='a',
product_line_translated_title='pl1',
debit_price=0,
credit_price=300,
total_price=-300,
Movement_getSectionPriceCurrency='EUR',
debit=0, credit=300, total_quantity=-300,
resource_reference='EUR',
Movement_getPaymentTitle=None,
payment_mode_translated_title=None,
grouping_reference=None,
grouping_date=None,
getTranslatedSimulationStateTitle='Closed')
self.checkLineProperties(data_line_list[1],
Movement_getNodeGapId='7',
node_translated_title='Goods Sales',
section_title='My Organisation',
mirror_section_title='Client 1',
date=DateTime(2006, 2, 2),
Movement_getSpecificReference='1',
Movement_getExplanationTranslatedPortalType=
'Sale Invoice Transaction',
Movement_getExplanationTitle='Detailed Transaction',
Movement_getExplanationReference='DT',
function='b',
product_line_translated_title='pl1',
debit_price=0,
credit_price=500,
total_price=-500,
Movement_getSectionPriceCurrency='EUR',
debit=0, credit=500, total_quantity=-500,
resource_reference='EUR',
Movement_getPaymentTitle=None,
payment_mode_translated_title=None,
grouping_reference=None,
grouping_date=None,
getTranslatedSimulationStateTitle='Closed')
self.checkLineProperties(data_line_list[2],
Movement_getNodeGapId='7',
node_translated_title='Goods Sales',
section_title='My Organisation',
mirror_section_title='Client 1',
date=DateTime(2006, 2, 2),
Movement_getSpecificReference='1',
Movement_getExplanationTranslatedPortalType=
'Sale Invoice Transaction',
Movement_getExplanationTitle='Detailed Transaction',
Movement_getExplanationReference='DT',
function='b',
product_line_translated_title=None,
debit_price=0,
credit_price=700,
total_price=-700,
Movement_getSectionPriceCurrency='EUR',
debit=0, credit=700, total_quantity=-700,
resource_reference='EUR',
Movement_getPaymentTitle=None,
payment_mode_translated_title=None,
grouping_reference=None,
grouping_date=None,
getTranslatedSimulationStateTitle='Closed')
# There is no stat line in export
stat_line = line_list[-1]
self.assertFalse(line_list[-1].isStatLine())
def testGeneralLedgerAnalyticsShown(self): def testGeneralLedgerAnalyticsShown(self):
self.project_1.validate() self.project_1.validate()
self.project_2.validate() self.project_2.validate()
...@@ -4466,9 +4519,9 @@ DT, b, P1 - Project 1, pl1''', ...@@ -4466,9 +4519,9 @@ DT, b, P1 - Project 1, pl1''',
self.checkLineProperties(data_line_list[2], self.checkLineProperties(data_line_list[2],
Movement_getExplanationTitleAndAnalytics='''Detailed Transaction Movement_getExplanationTitleAndAnalytics='''Detailed Transaction
DT, b, P2 - Project 2''', DT, b, P2 - Project 2''',
debit_price=0, debit_price=0,
credit_price=700, credit_price=700,
running_total_price=-1500) running_total_price=-1500)
stat_line = line_list[-1] stat_line = line_list[-1]
self.assertTrue(line_list[-1].isStatLine()) self.assertTrue(line_list[-1].isStatLine())
......
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