Commit 7e0e3fed authored by Tomáš Peterka's avatar Tomáš Peterka

[erp5_accounting_renderjs_ui_test] Add accounting report tests

-  remove hack when tests were using each others data by `markChanged` script
parent 3ae162e5
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Zuite" module="Products.Zelenium.zuite"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>renderjs_ui_accounting_report_zuite</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test_account_statement</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<html>
<head><title>Test Account Statement</title></head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><th rowspan="1" colspan="4">
Copy of unittest <a href="https://lab.nexedi.com/nexedi/erp5/blob/master/product/ERP5/tests/testAccountingReports.py#L894">testAccountingReports.py:TestAccountingReports.testAccountStatement</a>
</th></tr>
</thead>
<tbody
tal:define="init_method string:AccountingZuite_initializeAccountingTransactionReportTest?report_name=account-statement&report_style=Hal;
now python:DateTime();
today python:DateTime(now.year(), now.month(), now.day());
tomorrow python:today + 1;
yesterday python:today - 1;
offset python:0">
<tal:block metal:use-macro="here/AccountingZuite_CommonTemplate/macros/init"/>
<tr><td>store</td><td tal:content="python: '{:0>#2d}'.format(now.day())"></td><td>day</td></tr>
<tr><td>store</td><td tal:content="python: '{:0>#2d}'.format(now.month())"></td><td>month</td></tr>
<tr><td>store</td><td tal:content="python: now.year()"></td><td>year</td></tr>
<tr><td>store</td><td tal:content="python: '{:d}-{:0>#2d}-{:0>#2d}'.format(today.year(), today.month(), today.day())"></td><td>today</td></tr>
<tr><td>store</td><td tal:content="python: '{:d}-{:0>#2d}-{:0>#2d}'.format(tomorrow.year(), tomorrow.month(), tomorrow.day())"></td><td>tomorrow</td></tr>
<tr><td>store</td><td tal:content="python: '{:d}-{:0>#2d}-{:0>#2d}'.format(yesterday.year(), yesterday.month(), yesterday.day())"></td><td>yesterday</td></tr>
<tr><td>store</td>
<td>${base_url}/web_site_module/renderjs_runner</td>
<td>renderjs_url</td></tr>
<tr><td>open</td>
<td>${renderjs_url}/#/accounting_module/</td><td></td></tr>
<tr><td>waitForElementPresent</td>
<td>//a[@data-i18n="Export"]</td><td></td></tr>
<tr><td>click</td>
<td>//a[@data-i18n="Export"]</td><td></td></tr>
<tr><td>waitForElementPresent</td>
<td>//div[contains(@data-gadget-url, 'gadget_erp5_page_export.html')]//ul/li</td><td></td></tr>
<tr><td>assertElementPresent</td>
<td>//a[@data-i18n="Account Statement"]</td><td></td></tr>
<tr><td>click</td>
<td>//a[@data-i18n="Account Statement"]</td><td></td></tr>
<tr><td>waitForElementPresent</td>
<td>//div[@data-gadget-scope="field_your_node"]/div/div[1]//select</td><td></td></tr>
<tr><td>select</td>
<td>//div[@data-gadget-scope="field_your_node"]/div/div[1]//select</td>
<td>value=account_module/receivable</td></tr>
<tr><td>waitForElementPresent</td>
<td>//select[@name="field_your_section_category"]</td><td></td></tr>
<tr><td>select</td>
<td>//select[@name="field_your_section_category"]</td>
<td>value=group/demo_group/sub1</td></tr>
<tr><td>waitForElementPresent</td>
<td>//input[@name="field_your_at_date"]</td><td></td></tr>
<tr><td>type</td>
<td>//input[@name="field_your_at_date"]</td>
<td>${today}</td></tr>
<!-- field_your_section_category_strict is False by default -->
<!-- field_your_portal_type is good by default -->
<tr><td>waitForElementPresent</td>
<td>//div[@data-gadget-scope="field_your_simulation_state"]/div/div[1]//select</td><td></td></tr>
<!-- we need to zero-out simulation_state to just 'delivered' -->
<tal:block tal:repeat="_ python:range(4)"><!-- There is by default just few simulation states -->
<!-- we take advantage of dissapearing elements when selecting one empty -->
<tr><td>select</td>
<td>//div[@data-gadget-scope="field_your_simulation_state"]/div/div[1]//select</td>
<td>value=</td></tr>
<tr><td>pause</td>
<td>50</td>
<td></td></tr>
</tal:block>
<tr><td>select</td>
<td>//div[@data-gadget-scope="field_your_simulation_state"]/div/div[1]//select</td>
<td>value=delivered</td></tr>
<tr><td>click</td>
<td>//div[@data-gadget-url="${renderjs_url}/gadget_erp5_page_form.html"]//input[@type="submit"]</td><td></td></tr>
<tr><td>store</td>
<td>//div[@data-gadget-url="${renderjs_url}/gadget_erp5_field_listbox.html"]//table</td>
<td>table</td></tr>
<tr><td>waitForElementPresent</td>
<td>${table}//../nav//span[@data-i18n="6 Records"]</td><td></td></tr>
<tr><td>waitForElementPresent</td>
<td>//div[@data-gadget-scope="field_your_currency"]//p[text()="EUR"]</td><td></td></tr>
<tal:block tal:define="row_selector string:$${table}/tbody/tr[1];
Movement_getSpecificReference string:1;
date string:$${yesterday};
mirror_section_title string:Client 1;
Movement_getExplanationTitleAndAnalytics string:Transaction 1 ref1;
debit_price string:100;
credit_price string:0;
running_total_price string:100">
<tal:block metal:use-macro="here/AccountingZuite_reportMacros/macros/check_row_in_accounts_table" />
</tal:block>
<tal:block tal:define="row_selector string:$${table}/tbody/tr[2];
Movement_getSpecificReference string:2;
date string:$${yesterday};
mirror_section_title string:Client 1;
Movement_getExplanationTitleAndAnalytics string:Transaction 2 ref2;
debit_price string:0;
credit_price string:200;
running_total_price string:-100">
<tal:block metal:use-macro="here/AccountingZuite_reportMacros/macros/check_row_in_accounts_table" />
</tal:block>
<tal:block tal:define="row_selector string:$${table}/tbody/tr[3];
Movement_getSpecificReference string:3;
date string:$${today};
Movement_getExplanationTitleAndAnalytics string:Transaction 3 ref3;
debit_price string:300;
credit_price string:0;
running_total_price string:200">
<tal:block metal:use-macro="here/AccountingZuite_reportMacros/macros/check_row_in_accounts_table" />
</tal:block>
<tal:block tal:define="row_selector string:$${table}/tbody/tr[4];
Movement_getSpecificReference string:4;
date string:$${today};
Movement_getExplanationTitleAndAnalytics string:Transaction 4 ref4;
debit_price string:400;
credit_price string:0;
running_total_price string:600">
<tal:block metal:use-macro="here/AccountingZuite_reportMacros/macros/check_row_in_accounts_table" />
</tal:block>
<tal:block tal:define="row_selector string:$${table}/tbody/tr[5];
Movement_getSpecificReference string:5;
date string:$${today};
Movement_getExplanationTitleAndAnalytics string:Transaction 5 ref5;
debit_price string:500;
credit_price string:0;
running_total_price string:1100">
<tal:block metal:use-macro="here/AccountingZuite_reportMacros/macros/check_row_in_accounts_table" />
</tal:block>
<tal:block tal:define="row_selector string:$${table}/tbody/tr[6];
Movement_getSpecificReference string:6;
date string:$${today};
Movement_getExplanationTitleAndAnalytics string:Transaction 6 ref6;
debit_price string:600;
credit_price string:0;
running_total_price string:1700">
<tal:block metal:use-macro="here/AccountingZuite_reportMacros/macros/check_row_in_accounts_table" />
</tal:block>
<tal:block tal:define="row_selector string:$${table}/tfoot/tr[1];
debit_price string:1900;
credit_price string:200">
<tal:block metal:use-macro="here/AccountingZuite_reportMacros/macros/check_row_in_accounts_table" />
</tal:block>
</tbody>
</table>
</body>
</html>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test_aged_balance</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<html>
<head><title>Test Aged Balance Report</title></head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><th rowspan="1" colspan="4">
Copy of unittest <a href="https://lab.nexedi.com/nexedi/erp5/blob/master/product/ERP5/tests/testAccountingReports.py#L4904">testAccountingReports.py:test_simple_aged_creditor_report_detailed.testOtherPartiesReport</a>
</th></tr>
</thead>
<tbody
tal:define="init_method string:AccountingZuite_initializeAccountingTransactionReportTest?report_name=aged-balance&report_style=Hal;
now python:DateTime();
last_month python:DateTime(now.year(), now.month(), 1) - 1;
offset python:0">
<tal:block metal:use-macro="here/AccountingZuite_CommonTemplate/macros/init"/>
<tr><td>store</td><td tal:content="python: '{:0>#2d}'.format(now.month())"></td><td>month</td></tr>
<tr><td>store</td><td tal:content="python: now.year()"></td><td>year</td></tr>
<tr><td>store</td><td tal:content="python: '{:0>#2d}'.format(last_month.day())"></td><td>last_day</td></tr>
<tr><td>store</td><td tal:content="python: '{:0>#2d}'.format(last_month.month())"></td><td>last_month</td></tr>
<tr><td>store</td><td tal:content="python: last_month.year()"></td><td>last_year</td></tr>
<tr><td>store</td>
<td>${base_url}/web_site_module/renderjs_runner</td>
<td>renderjs_url</td></tr>
<tr><td>open</td>
<td>${renderjs_url}/#/accounting_module/</td><td></td></tr>
<tr><td>waitForElementPresent</td>
<td>//a[@data-i18n="Export"]</td><td></td></tr>
<tr><td>click</td>
<td>//a[@data-i18n="Export"]</td><td></td></tr>
<tr><td>waitForElementPresent</td>
<td>//a[@data-i18n="Aged Balance"]</td><td></td></tr>
<tr><td>click</td>
<td>//a[@data-i18n="Aged Balance"]</td><td></td></tr>
<tr><td>waitForElementPresent</td>
<td>//select[@name="field_your_section_category"]</td><td></td></tr>
<tr><td>select</td>
<td>//select[@name="field_your_section_category"]</td>
<td>value=group/demo_group</td></tr>
<tr><td>waitForElementPresent</td>
<td>//div[@data-gadget-scope="field_your_account_type"]//select</td><td></td></tr>
<tr><td>select</td>
<td>//div[@data-gadget-scope="field_your_account_type"]//select</td>
<td>value=account_type/asset/receivable</td></tr>
<tr><td>type</td>
<td>//input[@name="field_your_at_date"]</td>
<td>${year}-${month}-01</td></tr>
<tr><td>click</td><!-- Check because it is unchecked by default -->
<td>//input[@type="checkbox" and @name="field_your_detailed"]</td><td></td></tr>
<tr><td>type</td>
<td>//textarea[@name="field_your_period_list"]</td>
<td>1<br/>
2<br/>
3<br/></td></tr>
<tr><td>waitForElementPresent</td>
<td>//div[@data-gadget-scope="field_your_simulation_state"]/div/div[1]//select</td><td></td></tr>
<!-- we need to zero-out simulation_state to just 'delivered' -->
<tal:block tal:repeat="_ python:range(4)"><!-- There is by default just few simulation states -->
<!-- we take advantage of dissapearing elements when selecting one empty -->
<tr><td>select</td>
<td>//div[@data-gadget-scope="field_your_simulation_state"]/div/div[1]//select</td>
<td>value=</td></tr>
<tr><td>pause</td>
<td>50</td>
<td></td></tr>
</tal:block>
<tr><td>select</td>
<td>//div[@data-gadget-scope="field_your_simulation_state"]/div/div[1]//select</td>
<td>value=delivered</td></tr>
<tr><td>click</td>
<td>//div[@data-gadget-url="${renderjs_url}/gadget_erp5_page_form.html"]//input[@type="submit"]</td><td></td></tr>
<tr><td>store</td>
<td>//div[@data-gadget-url="${renderjs_url}/gadget_erp5_field_listbox.html"]//table</td>
<td>table</td></tr>
<tr><td>waitForElementPresent</td>
<td>${table}/../nav//span[@data-i18n="1 Records"]</td><td></td></tr>
<tr><td>waitForElementPresent</td>
<td>//div[@data-gadget-scope="field_your_currency"]//p[text()="EUR"]</td><td></td></tr>
<tr><td>store</td>
<td>${table}/tbody/tr[1]</td>
<td>current_row</td></tr>
<tr><td>assertText</td>
<td>${current_row}/td[1]/a</td>
<td>Client 1</td></tr>
<tr><td>assertText</td>
<td>${current_row}/td[2]/a</td>
<td>Sale invoice 2</td></tr>
<!-- skip account_number field -->
<!-- skip invoice_number field -->
<!-- skip transaction_reference field -->
<tr><td>verifyElementPresent</td>
<td>${current_row}/td[6]//p[@data-date="${last_year}-${last_month}-${last_day}"]</td><td></td></tr>
<tr><td>assertText</td>
<td>${current_row}/td[7]/a</td>
<td>Sale Invoice Transaction</td></tr>
<tr><td>assertFloat</td>
<td>${current_row}/td[8]//div[@data-gadget-url="${renderjs_url}/gadget_html5_element.html"]/p</td>
<td>300</td></tr><!-- balance -->
<tr><td>assertText</td>
<td>${current_row}/td[9]//div[@data-gadget-url="${renderjs_url}/gadget_html5_element.html"]/p</td>
<td></td></tr><!-- future is empty -->
<tr><td>assertFloat</td>
<td>${current_row}/td[10]//div[@data-gadget-url="${renderjs_url}/gadget_html5_element.html"]/p</td>
<td>300</td></tr><!-- period_1=300 -->
</tbody>
</table>
</body>
</html>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test_balance_sheet</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<html>
<head><title>Test Balance Sheet Report</title></head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><th rowspan="1" colspan="4">
Copy of unittest <a href="https://lab.nexedi.com/nexedi/erp5/blob/master/product/ERP5/tests/testAccountingReports.py#L4563">testAccountingReports.py:TestAccountingReports.testBalanceSheet</a>
</th></tr>
</thead>
<tbody
tal:define="init_method string:AccountingZuite_initializeAccountingTransactionReportTest?report_name=balance-sheet&report_style=Hal;
offset python:0;
now python:DateTime()">
<tal:block metal:use-macro="here/AccountingZuite_CommonTemplate/macros/init"/>
<tr><td>store</td><td tal:content="python: '{:0>#2d}'.format(now.day())"></td><td>day</td></tr>
<tr><td>store</td><td tal:content="python: '{:0>#2d}'.format(now.month())"></td><td>month</td></tr>
<tr><td>store</td><td tal:content="python: now.year()"></td><td>year</td></tr>
<tr><td>store</td>
<td>${base_url}/web_site_module/renderjs_runner</td>
<td>renderjs_url</td></tr>
<tr><td>open</td>
<td>${renderjs_url}/#/accounting_module/</td><td></td></tr>
<tr><td>waitForElementPresent</td>
<td>//a[@data-i18n="Export"]</td><td></td></tr>
<tr><td>click</td>
<td>//a[@data-i18n="Export"]</td><td></td></tr>
<tr><td>waitForElementPresent</td>
<td>//a[@data-i18n="Balance Sheet"]</td><td></td></tr>
<tr><td>click</td>
<td>//a[@data-i18n="Balance Sheet"]</td><td></td></tr>
<tr><td>waitForElementPresent</td>
<td>//select[@name="field_your_section_category"]</td><td></td></tr>
<tr><td>select</td>
<td>//select[@name="field_your_section_category"]</td>
<td>value=group/demo_group</td></tr>
<tr><td>type</td>
<td>//input[@name="field_your_at_date"]</td>
<td>${year}-12-31</td></tr>
<!-- We cannot easily ensure correctness because the report renders always as
an attachment. Even in unittest we only check validity of such attachment.
-->
</tbody>
</table>
</body>
</html>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test_general_ledger</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test_invoices_report</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<html>
<head><title>Test Invoices Report</title></head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><th rowspan="1" colspan="4">
No test!
</th></tr>
</thead>
<tbody>
<!-- There is no unittest covering this report so no UI test either. -->
</tbody>
</table>
</body>
</html>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test_journal</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<html>
<head><title>Test Report Journal</title></head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><th rowspan="1" colspan="4">
Copy of <a href="https://lab.nexedi.com/nexedi/erp5/blob/master/product/ERP5/tests/testAccountingReports.py#L53">TestAccountingReports.testJournal</a>
</th></tr>
</thead>
<tbody
tal:define="init_method string:AccountingZuite_initializeAccountingTransactionReportTest?report_name=journal&report_style=Hal;
now python: DateTime()">
<tal:block metal:use-macro="here/AccountingZuite_CommonTemplate/macros/init"/>
<tr><td>store</td>
<td>${base_url}/web_site_module/renderjs_runner</td>
<td>renderjs_url</td></tr>
<tr><td>open</td>
<td>${renderjs_url}/#/accounting_module/</td><td></td></tr>
<tr><td>waitForElementPresent</td>
<td>//a[@data-i18n="Export"]</td><td></td></tr>
<tr><td>click</td>
<td>//a[@data-i18n="Export"]</td><td></td></tr>
<tr><td>waitForElementPresent</td>
<td>//a[@data-i18n="Journal"]</td><td></td></tr>
<tr><td>click</td>
<td>//a[@data-i18n="Journal"]</td><td></td></tr>
<tr><td>waitForElementPresent</td>
<td>//select[@name="field_your_section_category"]</td><td></td></tr>
<tr><td>select</td>
<td>//select[@name="field_your_section_category"]</td>
<td>value=group/demo_group</td></tr>
<!-- field_your_at_date is already at now() -->
<!-- field_your_section_category_strict is False by default -->
<tr><td>waitForElementPresent</td>
<td>//div[@data-gadget-scope="field_your_portal_type"]/div/div[1]//select</td><td></td></tr>
<!-- we need to zero-out portal_types to just 'Sale Invoice Transaction' -->
<tal:block tal:repeat="_ python:range(8)"><!-- there is by default many Portal Types -->
<!-- we take advantage of dissapearing elements when selecting one empty -->
<tr><td>select</td>
<td>//div[@data-gadget-scope="field_your_portal_type"]/div/div[1]//select</td>
<td>value=</td></tr>
<tr><td>pause</td>
<td>50</td>
<td></td></tr>
</tal:block>
<tr><td>select</td>
<td>//div[@data-gadget-scope="field_your_portal_type"]/div/div[1]//select</td>
<td>value=Sale Invoice Transaction</td></tr>
<tr><td>waitForElementPresent</td>
<td>//div[@data-gadget-scope="field_your_simulation_state"]/div/div[1]//select</td><td></td></tr>
<!-- we need to zero-out simulation_state to just 'delivered' -->
<tal:block tal:repeat="_ python:range(4)"><!-- There is by default just few simulation states -->
<!-- we take advantage of dissapearing elements when selecting one empty -->
<tr><td>select</td>
<td>//div[@data-gadget-scope="field_your_simulation_state"]/div/div[1]//select</td>
<td>value=</td></tr>
<tr><td>pause</td>
<td>50</td>
<td></td></tr>
</tal:block>
<tr><td>select</td>
<td>//div[@data-gadget-scope="field_your_simulation_state"]/div/div[1]//select</td>
<td>value=delivered</td></tr>
<tr><td>click</td>
<td>//div[@data-gadget-url="${renderjs_url}/gadget_erp5_page_form.html"]//input[@type="submit"]</td><td></td></tr>
<tr><td>store</td>
<td>//div[@data-gadget-url="${renderjs_url}/gadget_erp5_field_listbox.html"]//table</td>
<td>table</td></tr>
<tr><td>waitForElementPresent</td>
<td>${table}//../nav//span[@data-i18n="9 Records"]</td><td></td></tr>
<tr><td>waitForElementPresent</td>
<td>//div[@data-gadget-scope="field_your_currency"]//p[text()="EUR"]</td><td></td></tr>
<tr><td>store</td><td tal:content="python: '{:0>#2d}'.format(now.day())"></td><td>day</td></tr>
<tr><td>store</td><td tal:content="python: '{:0>#2d}'.format(now.month())"></td><td>month</td></tr>
<tr><td>store</td><td tal:content="python: now.year()"></td><td>year</td></tr>
<tal:block tal:define="row_selector string:$${table}/tbody/tr[1];
date string:$${year}-$${month}-$${day};
title string:First One;
parent_reference string:1;
node_title string:A-REC;
mirror_section_title string:Client 1;
debit string:119.60;
credit string:0">
<tal:block metal:use-macro="here/AccountingZuite_reportMacros/macros/check_row_in_transactions_table" />
</tal:block>
<tal:block tal:define="row_selector string:$${table}/tbody/tr[2];
specific_reference string:;
title string:;
parent_reference string:;
node_title string:A-COLLECTED-VAT;
mirror_section_title string:Client 1;
debit string:0,
credit string:19.60">
<tal:block metal:use-macro="here/AccountingZuite_reportMacros/macros/check_row_in_transactions_table" />
</tal:block>
<tal:block tal:define="row_selector string:$${table}/tbody/tr[3];
specific_reference string:;
title string:;
parent_reference string:;
node_title string:A-GS;
mirror_section_title string:Client 1;
debit string:0;
credit string:100">
<tal:block metal:use-macro="here/AccountingZuite_reportMacros/macros/check_row_in_transactions_table" />
</tal:block>
<!-- Second Transaction -->
<tal:block tal:define="row_selector string:$${table}/tbody/tr[4];
date string:$${year}-$${month}-$${day};
title string:Second One;
parent_reference string:2;
node_title string:A-REC;
mirror_section_title string:Client 2;
debit string:239.20;
credit string:0">
<tal:block metal:use-macro="here/AccountingZuite_reportMacros/macros/check_row_in_transactions_table" />
</tal:block>
<tal:block tal:define="row_selector string:$${table}/tbody/tr[5];
specific_reference string:;
title string:;
parent_reference string:;
node_title string:A-COLLECTED-VAT;
mirror_section_title string:Client 2;
debit string:0;
credit string:39.20">
<tal:block metal:use-macro="here/AccountingZuite_reportMacros/macros/check_row_in_transactions_table" />
</tal:block>
<tal:block tal:define="row_selector string:$${table}/tbody/tr[6];
specific_reference string:;
title string:;
parent_reference string:;
node_title string:A-GS;
mirror_section_title string:Client 2;
debit string:0;
credit string:200">
<tal:block metal:use-macro="here/AccountingZuite_reportMacros/macros/check_row_in_transactions_table" />
</tal:block>
<!-- Third Transaction -->
<tal:block tal:define="row_selector string:$${table}/tbody/tr[7];
date string:$${year}-$${month}-$${day};
title string:Third One;
parent_reference string:3;
node_title string:A-REC;
mirror_section_title string:John Smith;
debit string:358.80;
credit string:0">
<tal:block metal:use-macro="here/AccountingZuite_reportMacros/macros/check_row_in_transactions_table" />
</tal:block>
<tal:block tal:define="row_selector string:$${table}/tbody/tr[8];
specific_reference string:;
title string:;
parent_reference string:;
node_title string:A-COLLECTED-VAT;
mirror_section_title string:John Smith;
debit string:0;
credit string:58.80">
<tal:block metal:use-macro="here/AccountingZuite_reportMacros/macros/check_row_in_transactions_table" />
</tal:block>
<tal:block tal:define="row_selector string:$${table}/tbody/tr[9];
specific_reference string:;
title string:Line Title;
parent_reference string:;
node_title string:A-GS;
mirror_section_title string:John Smith;
debit string:0;
credit string:300">
<tal:block metal:use-macro="here/AccountingZuite_reportMacros/macros/check_row_in_transactions_table" />
</tal:block>
<!-- Stats line -->
<tal:block tal:define="row_selector string:$${table}/tfoot/tr[1];
debit string:717.60;
credit string:717.60">
<tal:block metal:use-macro="here/AccountingZuite_reportMacros/macros/check_row_in_transactions_table" />
</tal:block>
</tbody>
</table>
</body>
</html>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test_profit_and_loss</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<html>
<head><title>Test Profit and Loss Report</title></head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><th rowspan="1" colspan="4">
Copy of unittest <a href="https://lab.nexedi.com/nexedi/erp5/blob/master/product/ERP5/tests/testAccountingReports.py#L4542">testAccountingReports.py:TestAccountingReports.testProfitAndLoss</a>
</th></tr>
</thead>
<tbody
tal:define="init_method string:AccountingZuite_initializeAccountingTransactionReportTest?report_name=profit-and-loss&report_style=Hal;
offset python:0;
now python:DateTime()">
<tal:block metal:use-macro="here/AccountingZuite_CommonTemplate/macros/init"/>
<tr><td>store</td><td tal:content="python: '{:0>#2d}'.format(now.day())"></td><td>day</td></tr>
<tr><td>store</td><td tal:content="python: '{:0>#2d}'.format(now.month())"></td><td>month</td></tr>
<tr><td>store</td><td tal:content="python: now.year()"></td><td>year</td></tr>
<tr><td>store</td>
<td>${base_url}/web_site_module/renderjs_runner</td>
<td>renderjs_url</td></tr>
<tr><td>open</td>
<td>${renderjs_url}/#/accounting_module/</td><td></td></tr>
<tr><td>waitForElementPresent</td>
<td>//a[@data-i18n="Export"]</td><td></td></tr>
<tr><td>click</td>
<td>//a[@data-i18n="Export"]</td><td></td></tr>
<tr><td>waitForElementPresent</td>
<td>//a[@data-i18n="Profit and Loss"]</td><td></td></tr>
<tr><td>click</td>
<td>//a[@data-i18n="Profit and Loss"]</td><td></td></tr>
<tr><td>waitForElementPresent</td>
<td>//select[@name="field_your_section_category"]</td><td></td></tr>
<tr><td>select</td>
<td>//select[@name="field_your_section_category"]</td>
<td>value=group/demo_group</td></tr>
<tr><td>type</td>
<td>//input[@name="field_your_at_date"]</td>
<td>${year}-12-31</td></tr>
<!-- We cannot easily ensure correctness because the report renders always as
an attachment. Even in unittest we only check validity of such attachment.
-->
</tbody>
</table>
</body>
</html>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test_restricted_skin_selection</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<html>
<head><title>Test Invoices Report Skin Allowance</title></head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><th rowspan="1" colspan="4">
Check that use gets notified if they are using wrong 'Report Style' (UI) Preference.
</th></tr>
</thead>
<!-- Set Report Style to not-allowed value 'View' -->
<tbody
tal:define="init_method string:AccountingZuite_initializeAccountingTransactionReportTest?report_name=journal&report_style=View;">
<tal:block metal:use-macro="here/AccountingZuite_CommonTemplate/macros/init"/>
<tr><td>store</td>
<td>${base_url}/web_site_module/renderjs_runner</td>
<td>renderjs_url</td></tr>
<tr><td>open</td>
<td>${renderjs_url}/#/accounting_module/</td><td></td></tr>
<!-- Select random Report and fill in just the necessary values for valid submission. -->
<tr><td>waitForElementPresent</td>
<td>//a[@data-i18n="Export"]</td><td></td></tr>
<tr><td>click</td>
<td>//a[@data-i18n="Export"]</td><td></td></tr>
<tr><td>waitForElementPresent</td>
<td>//a[@data-i18n="Journal"]</td><td></td></tr>
<tr><td>click</td>
<td>//a[@data-i18n="Journal"]</td><td></td></tr>
<tr><td>waitForElementPresent</td>
<td>//select[@name="field_your_section_category"]</td><td></td></tr>
<tr><td>select</td>
<td>//select[@name="field_your_section_category"]</td>
<td>value=group/demo_group</td></tr>
<tr><td>waitForElementPresent</td>
<td>//div[@data-gadget-url="${renderjs_url}/gadget_erp5_page_form.html"]//input[@type="submit"]</td><td></td></tr>
<tr><td>click</td>
<td>//div[@data-gadget-url="${renderjs_url}/gadget_erp5_page_form.html"]//input[@type="submit"]</td><td></td></tr>
<!-- Now we should get somehow notified about wrong skin selection.
At the beginning it was implemented as Form Message because the error is on a hidden field. -->
<tr><td>waitForElementPresent</td>
<td>//div[@data-gadget-scope="notification"]//button[contains(text(), "skins are allowed for reports")]</td><td></td></tr>
<tr><td>assertElementPresent</td>
<td>//div[@data-gadget-scope="notification"]//button[contains(text(), "skins are allowed for reports")]</td><td></td></tr>
</tbody>
</table>
</body>
</html>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test_third_parties</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<html>
<head><title>Test Third Party (aka Other Party) Report</title></head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><th rowspan="1" colspan="4">
Copy of unittest <a href="https://lab.nexedi.com/nexedi/erp5/blob/master/product/ERP5/tests/testAccountingReports.py#L4658">testAccountingReports.py:TestAccountingReports.testOtherPartiesReport</a>
</th></tr>
</thead>
<tbody
tal:define="init_method string:AccountingZuite_initializeAccountingTransactionReportTest?report_name=other-parties-ledger&report_style=Hal;
offset python:0;
now python:DateTime()">
<tal:block metal:use-macro="here/AccountingZuite_CommonTemplate/macros/init"/>
<tr><td>store</td><td tal:content="python: '{:0>#2d}'.format(now.day())"></td><td>day</td></tr>
<tr><td>store</td><td tal:content="python: '{:0>#2d}'.format(now.month())"></td><td>month</td></tr>
<tr><td>store</td><td tal:content="python: now.year()"></td><td>year</td></tr>
<tr><td>store</td>
<td>${base_url}/web_site_module/renderjs_runner</td>
<td>renderjs_url</td></tr>
<tr><td>open</td>
<td>${renderjs_url}/#/accounting_module/</td><td></td></tr>
<tr><td>waitForElementPresent</td>
<td>//a[@data-i18n="Export"]</td><td></td></tr>
<tr><td>click</td>
<td>//a[@data-i18n="Export"]</td><td></td></tr>
<tr><td>waitForElementPresent</td>
<td>//a[@data-i18n="Third Parties"]</td><td></td></tr>
<tr><td>click</td>
<td>//a[@data-i18n="Third Parties"]</td><td></td></tr>
<tr><td>waitForElementPresent</td>
<td>//select[@name="field_your_section_category"]</td><td></td></tr>
<tr><td>select</td>
<td>//select[@name="field_your_section_category"]</td>
<td>value=group/demo_group</td></tr>
<tr><td>waitForElementPresent</td>
<td>//div[@data-gadget-scope="field_your_ledger"]//select</td><td></td></tr>
<tr><td>select</td>
<td>//div[@data-gadget-scope="field_your_ledger"]//select</td>
<td>value=ledger/accounting/general</td></tr>
<tr><td>type</td>
<td>//input[@name="field_your_at_date"]</td>
<td>${year}-${month}-${day}</td></tr>
<tr><td>click</td><!-- Uncheck because it is checked by default -->
<td>//input[@type="checkbox" and @name="field_your_omit_balanced_accounts"]</td><td></td></tr>
<tr><td>waitForElementPresent</td>
<td>//div[@data-gadget-scope="field_your_simulation_state"]/div/div[1]//select</td><td></td></tr>
<!-- we need to zero-out simulation_state to just 'delivered' -->
<tal:block tal:repeat="_ python:range(4)"><!-- There is by default just few simulation states -->
<!-- we take advantage of dissapearing elements when selecting one empty -->
<tr><td>select</td>
<td>//div[@data-gadget-scope="field_your_simulation_state"]/div/div[1]//select</td>
<td>value=</td></tr>
<tr><td>pause</td>
<td>50</td>
<td></td></tr>
</tal:block>
<tr><td>select</td>
<td>//div[@data-gadget-scope="field_your_simulation_state"]/div/div[1]//select</td>
<td>value=delivered</td></tr>
<tr><td>click</td>
<td>//div[@data-gadget-url="${renderjs_url}/gadget_erp5_page_form.html"]//input[@type="submit"]</td><td></td></tr>
<tr><td>store</td>
<td>//div[@data-gadget-url="${renderjs_url}/gadget_erp5_field_listbox.html"]//table</td>
<td>table</td></tr>
<tr><td>waitForElementPresent</td>
<td>${table}//../nav//span[@data-i18n="2 Records"]</td><td></td></tr>
<tr><td>waitForElementPresent</td>
<td>//div[@data-gadget-scope="field_your_currency"]//p[text()="EUR"]</td><td></td></tr>
<tal:block tal:define="row_selector string:$${table}/tbody/tr[1];
Movement_getExplanationTitle string:Transaction 1;
section_title string:;
Movement_getExplanationTranslatedPortalType string:Accounting Transaction;
Movement_getNodeGapId string:A-REC;
Movement_getExplanationReference string:;
Movement_getSpecificReference string:1;
getTranslatedSimulationStateTitle string:Closed;
debit_price string:100;
credit_price string:0;
running_total_price string:100">
<tal:block metal:use-macro="here/AccountingZuite_reportMacros/macros/check_row_in_accounts_ledger_table" />
</tal:block>
<tal:block tal:define="row_selector string:$${table}/tbody/tr[2];
Movement_getExplanationTitle string:Transaction 2;
section_title string:;
Movement_getExplanationTranslatedPortalType string:Accounting Transaction;
Movement_getNodeGapId string:A-PAY;
Movement_getExplanationReference string:;
Movement_getSpecificReference string:2;
getTranslatedSimulationStateTitle string:Closed;
debit_price string:200;
credit_price string:0;
running_total_price string:300">
<tal:block metal:use-macro="here/AccountingZuite_reportMacros/macros/check_row_in_accounts_ledger_table" />
</tal:block>
<tal:block tal:define="row_selector string:$${table}/tfoot/tr[1];
debit_price string:300;
credit_price string:0">
<tal:block metal:use-macro="here/AccountingZuite_reportMacros/macros/check_row_in_accounts_ledger_table" />
</tal:block>
</tbody>
</table>
</body>
</html>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test_trial_balance</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<html>
<head><title>Test Trial Balance Report</title></head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><th rowspan="1" colspan="4">
Copy of unittest <a href="https://lab.nexedi.com/nexedi/erp5/blob/master/product/ERP5/tests/testAccountingReports.py#L2326">TestAccountingReports.testJournal</a>
</th></tr>
</thead>
<tbody
tal:define="init_method string:AccountingZuite_initializeAccountingTransactionReportTest?report_name=trial-balance&report_style=Hal;
now python: DateTime()">
<tal:block metal:use-macro="here/AccountingZuite_CommonTemplate/macros/init"/>
<tr><td>store</td>
<td>${base_url}/web_site_module/renderjs_runner</td>
<td>renderjs_url</td></tr>
<tr><td>open</td>
<td>${renderjs_url}/#/accounting_module/</td><td></td></tr>
<tr><td>waitForElementPresent</td>
<td>//a[@data-i18n="Export"]</td><td></td></tr>
<tr><td>click</td>
<td>//a[@data-i18n="Export"]</td><td></td></tr>
<tr><td>waitForElementPresent</td>
<td>//a[@data-i18n="Trial Balance"]</td><td></td></tr>
<tr><td>click</td>
<td>//a[@data-i18n="Trial Balance"]</td><td></td></tr>
<tr><td>store</td><td tal:content="python: '{:0>#2d}'.format(now.day())"></td><td>day</td></tr>
<tr><td>store</td><td tal:content="python: '{:0>#2d}'.format(now.month())"></td><td>month</td></tr>
<tr><td>store</td><td tal:content="python: now.year()"></td><td>year</td></tr>
<tr><td>waitForElementPresent</td>
<td>//select[@name="field_your_section_category"]</td><td></td></tr>
<tr><td>select</td>
<td>//select[@name="field_your_section_category"]</td>
<td>value=group/demo_group</td></tr>
<tr><td>type</td>
<td>//input[@name="field_your_from_date"]</td>
<td>${year}-01-01</td></tr>
<tr><td>type</td>
<td>//input[@name="field_your_at_date"]</td>
<td>${year}-12-31</td></tr>
<!-- field_your_section_category_strict is False by default -->
<!-- field_your_per_account_class_summary is False by default -->
<!-- field_your_expand_accounts is False by default -->
<tr><td>click</td>
<td>//input[@type="checkbox" and @name="field_your_show_empty_accounts"]</td><td></td></tr>
<tr><td>click</td>
<td>//input[@type="checkbox" and @name="field_your_show_detailed_balance_columns"]</td><td></td></tr>
<!-- let field_your_portal_type its default values -->
<!-- For simulation state only ensure that default values are still "delivered" and "stopped" -->
<tr><td>store</td>
<td>//div[@data-gadget-scope="field_your_simulation_state"]//div[@data-gadget-url="${renderjs_url}/gadget_erp5_field_multilist.html"]</td>
<td>multi_select</td></tr>
<tr><td>waitForElementPresent</td>
<td>${multi_select}/div[3]//select</td><td></td></tr>
<tr><td>assertValue</td>
<td>${multi_select}/div[1]//select</td>
<td>delivered</td></tr>
<tr><td>assertValue</td>
<td>${multi_select}/div[2]//select</td>
<td>stopped</td></tr>
<tr><td>assertValue</td>
<td>${multi_select}/div[3]//select</td>
<td></td></tr>
<tr><td>click</td>
<td>//div[@data-gadget-url="${renderjs_url}/gadget_erp5_page_form.html"]//input[@type="submit"]</td><td></td></tr>
<tr><td>store</td>
<td>//div[@data-gadget-url="${renderjs_url}/gadget_erp5_field_listbox.html"]//table</td>
<td>table</td></tr>
<tr><td>waitForElementPresent</td>
<td>${table}//../nav//span[@data-i18n="10 Records"]</td><td></td></tr>
<tr><td>waitForElementPresent</td>
<td>//div[@data-gadget-scope="field_your_currency"]//p[text()="EUR"]</td><td></td></tr>
<!-- ListBox sorts the result in different order than they are returned by its
List Method. Seems they are sorted on Title alphabetically -->
<tal:block tal:define="row_selector string:$${table}/tbody/tr[1];
node_id string:A-BANK;
node_title string:Bank (Bank1);
credit string:3300;
final_balance string:-3300;
final_credit_balance string:3300;
final_balance_if_credit string:3300">
<tal:block metal:use-macro="here/AccountingZuite_reportMacros/macros/check_row_in_balance_table" />
</tal:block>
<tal:block tal:define="row_selector string:$${table}/tbody/tr[2];
node_id string:A-COLLECTED-VAT;
node_title string:Collected VAT 10%">
<tal:block metal:use-macro="here/AccountingZuite_reportMacros/macros/check_row_in_balance_table" />
</tal:block>
<tal:block tal:define="row_selector string:$${table}/tbody/tr[3];
node_id string:A-EQUITY;
node_title string:Equity">
<tal:block metal:use-macro="here/AccountingZuite_reportMacros/macros/check_row_in_balance_table" />
</tal:block>
<tal:block tal:define="row_selector string:$${table}/tbody/tr[4];
node_id string:A-FIX-ASSETS;
node_title string:Fixed Assets">
<tal:block metal:use-macro="here/AccountingZuite_reportMacros/macros/check_row_in_balance_table" />
</tal:block>
<tal:block tal:define="row_selector string:$${table}/tbody/tr[5];
node_id string:A-GP;
node_title string:Goods Purchase">
<tal:block metal:use-macro="here/AccountingZuite_reportMacros/macros/check_row_in_balance_table" />
</tal:block>
<tal:block tal:define="row_selector string:$${table}/tbody/tr[6];
node_id string:A-GS;
node_title string:Goods Sales">
<tal:block metal:use-macro="here/AccountingZuite_reportMacros/macros/check_row_in_balance_table" />
</tal:block>
<tal:block tal:define="row_selector string:$${table}/tbody/tr[7];
node_id string:A-PAY;
node_title string:Payable;
debit string:200;
credit string:100;
final_balance string:100;
final_debit_balance string:200;
final_credit_balance string:100;
final_balance_if_debit string:100">
<tal:block metal:use-macro="here/AccountingZuite_reportMacros/macros/check_row_in_balance_table" />
</tal:block>
<tal:block tal:define="row_selector string:$${table}/tbody/tr[8];
node_id string:A-REC;
node_title string:Receivable;
debit string:3400;
credit string:200;
final_balance string:3200;
final_debit_balance string:3400;
final_credit_balance string:200;
final_balance_if_debit string:3200">
<tal:block metal:use-macro="here/AccountingZuite_reportMacros/macros/check_row_in_balance_table" />
</tal:block>
<tal:block tal:define="row_selector string:$${table}/tbody/tr[9];
node_title string:Refundable VAT 10%;
node_id string:A-REF-VAT">
<tal:block metal:use-macro="here/AccountingZuite_reportMacros/macros/check_row_in_balance_table"></tal:block>
</tal:block>
<tal:block tal:define="row_selector string:$${table}/tbody/tr[10];
node_title string:Stocks;
node_id string:A-STOCK">
<tal:block metal:use-macro="here/AccountingZuite_reportMacros/macros/check_row_in_balance_table"></tal:block>
</tal:block>
<!-- Stats line -->
<tal:block tal:define="row_selector string:$${table}/tfoot/tr[1];
debit string:3600;
credit string:3600;
final_debit_balance string:3600;
final_credit_balance string:3600;
final_balance_if_debit string:3300;
final_balance_if_credit string:3300">
<tal:block metal:use-macro="here/AccountingZuite_reportMacros/macros/check_row_in_balance_table"></tal:block>
</tal:block>
</tbody>
</table>
</body>
</html>
\ No newline at end of file
##############################################################################
#
# Copyright (c) 2011 Nexedi SARL and Contributors. All Rights Reserved.
# Kazuhiko <kazuhiko@nexedi.com>
# Rafael Monnerat <rafael@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
import unittest
from Products.ERP5Type.tests.ERP5TypeFunctionalTestCase import ERP5TypeFunctionalTestCase
class TestRenderJSAccountingReport(ERP5TypeFunctionalTestCase):
foreground = 0
run_only = "renderjs_ui_accounting_report_zuite"
def getBusinessTemplateList(self):
return (
'erp5_accounting_renderjs_ui_test',
)
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestRenderJSAccountingReport))
return suite
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Test Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testFunctionalRJSAccountingReport</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testFunctionalRJSAccountingReport</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Test Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
</ZopeData>
Copyright (c) Nexedi SARL
\ No newline at end of file
erp5_accounting_ui_test
erp5_web_renderjs_ui_test
\ No newline at end of file
RenderJS UI tests for Accounting Module.
\ No newline at end of file
portal_tests/renderjs_ui_accounting_report_zuite
portal_tests/renderjs_ui_accounting_report_zuite/**
\ No newline at end of file
test.erp5.testFunctionalRJSAccountingReport
\ No newline at end of file
erp5_full_text_mroonga_catalog
\ No newline at end of file
erp5_accounting_renderjs_ui_test
\ No newline at end of file
...@@ -13,15 +13,6 @@ business_process = portal.portal_catalog.getResultValue( ...@@ -13,15 +13,6 @@ business_process = portal.portal_catalog.getResultValue(
'erp5_default_business_process'), # erp5_simulation_test 'erp5_default_business_process'), # erp5_simulation_test
portal_type='Business Process').getRelativeUrl() portal_type='Business Process').getRelativeUrl()
# if the previous test didn't change input data, no need to recreate content
current_script_data_id = '%s_month_count_%s_draft_%s_state_%s_payment_%s_leger_%s' % (
month_count, add_draft_transactions, transaction_state,
add_related_payments, set_ledger, script.getId())
if accounting_module.getProperty('current_content_script',
'') == current_script_data_id:
return "Accounting Transactions Created."
# first, cleanup accounting module # first, cleanup accounting module
# XXX should be done in an external script / tool, because we have to # XXX should be done in an external script / tool, because we have to
# workaround some security checks # workaround some security checks
...@@ -280,9 +271,6 @@ if add_draft_transactions: ...@@ -280,9 +271,6 @@ if add_draft_transactions:
source=getAccountByTitle('Goods Sales'), source=getAccountByTitle('Goods Sales'),
quantity=random.randint(300, 400),) quantity=random.randint(300, 400),)
accounting_module.setProperty('current_content_script',
current_script_data_id)
# test depends on this # test depends on this
return "Accounting Transactions Created." return "Accounting Transactions Created."
# vim: syntax=python # vim: syntax=python
...@@ -10,13 +10,6 @@ year = 2005 ...@@ -10,13 +10,6 @@ year = 2005
total_receivable_quantity = 0 total_receivable_quantity = 0
# if the previous test didn't change input data, no need to recreate content
current_script_data_id = '%s_month_count_%s' % (
month_count, script.getId())
if accounting_module.getProperty('current_content_script',
'') == current_script_data_id:
return "Accounting Transactions Created."
# first, cleanup accounting module # first, cleanup accounting module
# XXX should be done in an external script / tool, because we have to # XXX should be done in an external script / tool, because we have to
# workaround some security checks # workaround some security checks
...@@ -127,10 +120,6 @@ for month in range(1, month_count + 1): ...@@ -127,10 +120,6 @@ for month in range(1, month_count + 1):
'immediateReindexObject')), 'immediateReindexObject')),
).AccountingTransactionLine_resetGroupingReference() ).AccountingTransactionLine_resetGroupingReference()
accounting_module.setProperty('current_content_script',
current_script_data_id)
# test depends on this # test depends on this
return "Accounting Transactions Created." return "Accounting Transactions Created."
# vim: syntax=python # vim: syntax=python
...@@ -7,13 +7,6 @@ from DateTime import DateTime ...@@ -7,13 +7,6 @@ from DateTime import DateTime
from Products.ZSQLCatalog.SQLCatalog import SimpleQuery from Products.ZSQLCatalog.SQLCatalog import SimpleQuery
year = 2005 year = 2005
# if the previous test didn't change input data, no need to recreate content
current_script_data_id = '%s_month_count_%s' % (
month_count, script.getId())
if accounting_module.getProperty('current_content_script',
'') == current_script_data_id:
return "Accounting Transactions Created."
# first, cleanup accounting module # first, cleanup accounting module
# XXX should be done in an external script / tool, because we have to # XXX should be done in an external script / tool, because we have to
...@@ -99,8 +92,6 @@ for month in range(1, month_count + 1): ...@@ -99,8 +92,6 @@ for month in range(1, month_count + 1):
tr.setSourceReference('source_reference') tr.setSourceReference('source_reference')
tr.setDestinationReference('destination_reference') tr.setDestinationReference('destination_reference')
accounting_module.setProperty('current_content_script',
current_script_data_id)
# test depends on this # test depends on this
return "Accounting Transactions Created." return "Accounting Transactions Created."
......
"""Create document of `portal_type` inside `parent` or Accounting Module.
`embedded` is a list of documents to create inside the top-level document
`simulation_state` is known to be a workflow transition variable thus we correctly
use workflows to change the state
"""
portal = context.getPortalObject()
parent = parent or portal.accounting_module
document = parent.newContent(portal_type=portal_type, **kwargs)
for embed in embedded:
script(parent=document, **embed)
if simulation_state == 'planned':
document.plan()
elif simulation_state == 'validated':
document.validate()
elif simulation_state == 'confirmed':
document.confirm()
elif simulation_state in ('stopped', 'delivered'):
document.stop()
if simulation_state == 'delivered':
document.deliver()
return document
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>portal_type, simulation_state=None, parent=None, embedded=(), **kwargs</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>AccountingZuite_createDocument</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
"""Create data set for aged balance:
$last_month: Purchase invoice 1 (500)
$last_month: Sale invoice 2 (300)
$next_month: Payment 1 (500)
$this_month + one_day: Payment 2 (300)
"""
from Products.ZSQLCatalog.SQLCatalog import SimpleQuery
from DateTime import DateTime
portal = context.getPortalObject()
account_module = portal.account_module
organisation_module = portal.organisation_module
now = DateTime()
this_month = DateTime(now.year(), now.month(), 1)
last_month = this_month - 1
next_month = this_month + 32
later_this_month = this_month + 8
def get_object_by_title(portal_type, title):
"""Use portal catalog to search&fetch the object."""
result = portal.portal_catalog(
portal_type=portal_type,
title=SimpleQuery(title=title, comparison_operator='='))
if len(result) == 1:
return result[0].getObject()
return None
bank1 = get_object_by_title(portal_type='Bank Account', title='Bank1')
if bank1 is None:
bank1 = portal.AccountingZuite_createDocument(
portal_type='Bank Account', title='Bank1', simulation_state='validated',
parent=organisation_module.my_organisation)
purchase1 = portal.AccountingZuite_createDocument(
portal_type='Purchase Invoice Transaction',
title='Purchase invoice 1',
destination_reference='1',
source_reference='no',
reference='ref1',
simulation_state='delivered',
ledger='',
source_section_value=organisation_module.supplier,
start_date=last_month,
embedded=(dict(portal_type='Purchase Invoice Transaction Line',
destination_value=account_module.goods_purchase,
destination_debit=500.0),
dict(portal_type='Purchase Invoice Transaction Line',
destination_value=account_module.payable,
destination_credit=500.0)),
)
sale2 = portal.AccountingZuite_createDocument(
portal_type='Sale Invoice Transaction',
title='Sale invoice 2',
source_reference='2',
destination_reference='no',
reference='ref2',
simulation_state='delivered',
ledger='',
destination_section_value=organisation_module.client_1,
start_date=last_month,
embedded=(dict(portal_type='Sale Invoice Transaction Line',
source_value=account_module.goods_sales,
source_credit=300.0),
dict(portal_type='Sale Invoice Transaction Line',
source_value=account_module.receivable,
source_debit=300.0)),
)
portal.Zuite_waitForActivities()
payment3 = portal.AccountingZuite_createDocument(
portal_type='Payment Transaction',
title='Payment 1',
source_reference='3',
destination_reference='no',
simulation_state='delivered',
ledger='',
causality_value=purchase1,
payment_mode='payment_mode',
destination_section_value=organisation_module.supplier,
start_date=next_month,
embedded=(dict(portal_type='Accounting Transaction Line',
source_value=account_module.payable,
source_debit=500.0),
dict(portal_type='Accounting Transaction Line',
source_value=account_module.bank,
source_credit=500.0)),
)
payment4 = portal.AccountingZuite_createDocument(
portal_type='Payment Transaction',
title='Payment 2',
source_reference='4',
destination_reference='4',
simulation_state='delivered',
causality_value=sale2,
payment_mode='payment_mode',
ledger='',
destination_section_value=organisation_module.client_1,
start_date=later_this_month,
embedded=(dict(portal_type='Accounting Transaction Line',
source_value=account_module.bank,
source_debit=300.0),
dict(portal_type='Accounting Transaction Line',
source_value=account_module.receivable,
source_credit=300.0)),
)
# we should have all receivable and payable lines grouped.
for transaction in [purchase1, sale2, payment3, payment4]:
for line in transaction.getMovementList():
if (line.getSourceValue() in (account_module.receivable,
account_module.payable) or
line.getDestinationValue() in (account_module.receivable,
account_module.payable)):
assert line.getGroupingReference()
assert line.getGroupingDate()
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Python Script" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>AccountingZuite_createReportAgedBalanceDataset</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Python Script</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
"""Create Dataset for basic Trial Balance Report such as defined at
https://lab.nexedi.com/nexedi/erp5/blob/master/product/ERP5/tests/testAccountingReports.py#L563
The test operates on 'today' transactions.
"""
from DateTime import DateTime
portal = context.getPortalObject()
person_module = portal.person_module
accounting_module = portal.accounting_module
account_module = portal.account_module
organisation_module = portal.organisation_module
one_hour = 1.0 / 24.0
one_day = 1.0
now = DateTime()
today = DateTime(now.year(), now.month(), now.day()) + 8 * one_hour
yesterday = today - one_day
tomorrow = today + one_day
bank1 = context.AccountingZuite_createDocument(
parent=organisation_module.my_organisation,
portal_type='Bank Account',
title='Bank1',
simulation_state='validated'
)
bank2 = bank1
if two_banks:
bank2 = context.AccountingZuite_createDocument(
parent=organisation_module.my_organisation,
portal_type='Bank Account',
title='Bank2',
simulation_state='validated'
)
context.AccountingZuite_createDocument(
portal_type='Accounting Transaction',
title='Transaction 1',
source_reference='1',
reference='ref1',
simulation_state='delivered',
destination_section_value=organisation_module.client_1,
start_date=yesterday,
embedded=(dict(portal_type='Accounting Transaction Line',
source_value=account_module.receivable,
source_debit=100.0),
dict(portal_type='Accounting Transaction Line',
source_value=account_module.payable,
source_credit=100.0)),
)
context.AccountingZuite_createDocument(
portal_type='Accounting Transaction',
title='Transaction 2',
source_reference='2',
reference='ref2',
simulation_state='delivered',
destination_section_value=organisation_module.client_1,
start_date=yesterday + one_hour,
embedded=(dict(portal_type='Accounting Transaction Line',
source_value=account_module.payable,
source_debit=200.0),
dict(portal_type='Accounting Transaction Line',
source_value=account_module.receivable,
source_credit=200.0)),
)
# in the period
context.AccountingZuite_createDocument(
portal_type='Payment Transaction',
title='Transaction 3',
source_reference='3',
reference='ref3',
simulation_state='delivered',
source_payment_value=bank1,
destination_section_value=organisation_module.client_1,
start_date=today + one_hour,
embedded=(dict(portal_type='Accounting Transaction Line',
source_value=account_module.receivable,
source_debit=300.0),
dict(portal_type='Accounting Transaction Line',
source_value=account_module.bank,
source_credit=300.0)),
)
context.AccountingZuite_createDocument(
portal_type='Payment Transaction',
title='Transaction 4',
destination_reference='4',
reference='ref4',
simulation_state='delivered',
destination_section_value=organisation_module.my_organisation,
destination_payment_value=bank1,
source_section_value=organisation_module.client_2,
stop_date=today + 2 * one_hour,
start_date=yesterday,
embedded=(dict(portal_type='Accounting Transaction Line',
destination_value=account_module.receivable,
destination_debit=400.0),
dict(portal_type='Accounting Transaction Line',
destination_value=account_module.bank,
destination_credit=400.0)),
)
context.AccountingZuite_createDocument(
portal_type='Accounting Transaction',
title='Transaction 5',
source_reference='5',
reference='ref5',
simulation_state='delivered',
source_payment_value=bank2,
destination_section_value=person_module.john_smith,
start_date=today + 3 * one_hour,
embedded=(dict(portal_type='Accounting Transaction Line',
source_value=account_module.receivable,
source_debit=500.0),
dict(portal_type='Accounting Transaction Line',
source_value=account_module.bank,
source_credit=500.0)),
)
context.AccountingZuite_createDocument(
portal_type='Purchase Invoice Transaction',
title='Transaction 6',
destination_reference='6',
reference='ref6',
simulation_state='delivered',
destination_payment_value=bank2,
source_section_value=organisation_module.client_1,
start_date=yesterday + 2 * one_hour,
stop_date=today + 4 * one_hour,
embedded=(dict(portal_type='Purchase Invoice Transaction Line',
destination_value=account_module.receivable,
destination_debit=600.0),
dict(portal_type='Purchase Invoice Transaction Line',
destination_value=account_module.bank,
destination_credit=600.0)),
)
# another simulation state
context.AccountingZuite_createDocument(
portal_type='Accounting Transaction',
title='Transaction 7',
source_reference='7',
reference='ref7',
simulation_state='stopped',
source_payment_value=bank2,
destination_section_value=organisation_module.client_1,
start_date=today + 5 * one_hour,
embedded=(dict(portal_type='Accounting Transaction Line',
source_value=account_module.receivable,
source_debit=700.0),
dict(portal_type='Accounting Transaction Line',
source_value=account_module.bank,
source_credit=700.0)),
)
# after the period
context.AccountingZuite_createDocument(
portal_type='Accounting Transaction',
title='Transaction 8',
source_reference='8',
reference='ref8',
simulation_state='delivered',
source_payment_value=bank2,
destination_section_value=organisation_module.client_1,
start_date=tomorrow,
embedded=(dict(portal_type='Accounting Transaction Line',
source_value=account_module.receivable,
source_debit=800.0),
dict(portal_type='Accounting Transaction Line',
source_value=account_module.bank,
source_credit=800.0)),
)
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>two_banks=False</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>AccountingZuite_createReportDataset</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
from DateTime import DateTime
portal = context.getPortalObject()
accounting_module = portal.accounting_module
account_module = portal.account_module
one_hour = 1.0 / 24.0
today = DateTime(DateTime().Date()) + 8 * one_hour
yesterday = today - 1
tomorrow = today + 1
context.AccountingZuite_createDocument(
portal_type='Accounting Transaction',
simulation_state='delivered',
start_date=yesterday,
embedded=[
{"portal_type": 'Accounting Transaction Line',
"source_value": account_module.equity,
"source_debit": 100},
{"portal_type": 'Accounting Transaction Line',
"source_value": account_module.stocks,
"source_credit": 100}
]
)
context.AccountingZuite_createDocument(
portal_type='Sale Invoice Transaction',
title='First One',
simulation_state='delivered',
reference='1',
destination_section_value=portal.organisation_module.client_1,
start_date=today,
embedded=[
{"portal_type": 'Sale Invoice Transaction Line',
"source_value": account_module.receivable,
"source_debit": 119.60},
{"portal_type": 'Sale Invoice Transaction Line',
"source_value": account_module.collected_vat,
"source_credit": 19.60},
{"portal_type": 'Sale Invoice Transaction Line',
"source_value": account_module.goods_sales,
"source_credit": 100.00},
]
)
context.AccountingZuite_createDocument(
portal_type='Sale Invoice Transaction',
title='Second One',
simulation_state='delivered',
reference='2',
destination_section_value=portal.organisation_module.client_2,
start_date=today + one_hour,
# different values of hour minutes, because /for now/ sorting is
# done on date, uid. Sorting on [source|destination]_reference
# would be too heavy, and we just want a sort on date, with a
# stable order (hence the cheap sort on uid)
embedded=[
{"portal_type": 'Sale Invoice Transaction Line',
"source_value": account_module.receivable,
"source_debit": 239.20},
{"portal_type": 'Sale Invoice Transaction Line',
"source_value": account_module.collected_vat,
"source_credit": 39.20},
{"portal_type": 'Sale Invoice Transaction Line',
"source_value": account_module.goods_sales,
"source_credit": 200.00},
]
)
context.AccountingZuite_createDocument(
portal_type='Sale Invoice Transaction',
title='Third One',
simulation_state='delivered',
reference='3',
destination_section_value=portal.person_module.john_smith,
start_date=today + 2 * one_hour,
embedded=[
{"portal_type": 'Sale Invoice Transaction Line',
"source_value": account_module.receivable,
"source_debit": 358.80},
{"portal_type": 'Sale Invoice Transaction Line',
"source_value": account_module.collected_vat,
"source_credit": 58.80},
{"portal_type": 'Sale Invoice Transaction Line',
"source_value": account_module.goods_sales,
"title": 'Line Title',
"source_credit": 300.00},
]
)
context.AccountingZuite_createDocument(
portal_type='Accounting Transaction',
simulation_state='delivered',
start_date=today,
embedded=[
{"portal_type": 'Accounting Transaction Line',
"source_value": account_module.equity,
"source_debit": 111},
{"portal_type": 'Accounting Transaction Line',
"source_value": account_module.stocks,
"source_credit": 111},
]
)
context.AccountingZuite_createDocument(
portal_type='Sale Invoice Transaction',
simulation_state='delivered',
destination_section_value=portal.organisation_module.client_2,
start_date=tomorrow,
embedded=[
{"portal_type": "Sale Invoice Transaction Line",
"source_value": account_module.receivable,
"source_debit": 598.00},
{"portal_type": "Sale Invoice Transaction Line",
"source_value": account_module.collected_vat,
"source_credit": 98.00},
{"portal_type": "Sale Invoice Transaction Line",
"source_value": account_module.goods_sales,
"source_credit": 500.00}])
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>AccountingZuite_createReportJournalDataset</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
"""Create Dataset for basic Trial Balance Report such as defined at
https://lab.nexedi.com/nexedi/erp5/blob/master/product/ERP5/tests/testAccountingReports.py#L4583
The test operates on 'today' transactions.
:param with_ledger: if true then data are prepared for
testOtherPartiesReportLedger unittest rather than testOtherPartiesReport
"""
from DateTime import DateTime
portal = context.getPortalObject()
accounting_module = portal.accounting_module
account_module = portal.account_module
ledger = portal.portal_categories.ledger
organisation_module = portal.organisation_module
person_module = portal.person_module
one_hour = 1.0 / 24.0
now = DateTime()
today = DateTime(now.year(), now.month(), now.day()) + 8 * one_hour
if with_ledger:
extra_kwargs_general = {'ledger': 'accounting/general'}
extra_kwargs_detailed = {'ledger': 'accounting/detailed'}
accounting_ledger = ledger.get('accounting', None)
if accounting_ledger is None:
accounting_ledger = ledger.newContent(portal_type='Category', id='accounting')
for sub_category_name in ('general', 'detailed'):
sub_category = accounting_ledger.get(sub_category_name, None)
if sub_category is None:
sub_category = accounting_ledger.newContent(portal_type='Category', id=sub_category_name)
# necessary for the "ledger" form field to appear and have correct options
accounting_transaction = portal.portal_types.get('Accounting Transaction')
ledger_list = accounting_transaction.getLedgerList()
if 'accounting/general' not in ledger_list:
ledger_list.append('accounting/general')
if 'accounting/detailed' not in ledger_list:
ledger_list.append('accounting/detailed')
accounting_transaction.setLedgerList(ledger_list)
else:
extra_kwargs_general = {}
extra_kwargs_detailed = {}
context.AccountingZuite_createDocument(
portal_type='Accounting Transaction',
title='Transaction 1',
source_reference='1',
simulation_state='delivered',
destination_section_value=organisation_module.client_1,
start_date=today + 1 * one_hour,
embedded=(dict(portal_type='Accounting Transaction Line',
source_value=account_module.receivable,
source_debit=100.0),
dict(portal_type='Accounting Transaction Line',
source_value=account_module.goods_sales,
source_credit=100.0)),
**extra_kwargs_general
)
context.AccountingZuite_createDocument(
portal_type='Accounting Transaction',
title='Transaction 2',
source_reference='2',
simulation_state='delivered',
destination_section_value=organisation_module.client_1,
start_date=today + 2 * one_hour,
embedded=(dict(portal_type='Accounting Transaction Line',
source_value=account_module.payable, source_debit=200.0),
dict(portal_type='Accounting Transaction Line',
source_value=account_module.goods_sales,
source_credit=200.0)),
**extra_kwargs_general
)
if with_ledger:
context.AccountingZuite_createDocument(
portal_type='Accounting Transaction',
title='Transaction 3',
source_reference='3',
simulation_state='delivered',
destination_section_value=organisation_module.client_1,
start_date=today + 3 * one_hour,
embedded=(dict(portal_type='Accounting Transaction Line',
source_value=account_module.payable, source_debit=400.0),
dict(portal_type='Accounting Transaction Line',
source_value=account_module.goods_sales,
source_credit=400.0)),
**extra_kwargs_detailed
)
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Python Script" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>with_ledger=True</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>AccountingZuite_createReportOtherPartiesDataset</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Python Script</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
"""Create deterministically transactions to test outputs of Reports."""
from DateTime import DateTime
portal = context.getPortalObject()
module = portal.accounting_module
# This option is necessary for RJS interface to render Reports
# If you'd keep XHTML value "View" the RJS will not crash it will
# only refuse to validate Report Form View
portal.AccountingZuite_setAccountReferencePreference(report_style=report_style)
# First, clean up the module
module.manage_delObjects(list(module.objectIds()))
# Create datasets
if report_name == "journal":
module.AccountingZuite_createReportJournalDataset()
elif report_name in ("trial-balance", "general-ledger"):
module.AccountingZuite_createReportDataset()
elif report_name in ("account-statement", "balance-sheet", "profit-and-loss"):
module.AccountingZuite_createReportDataset(two_banks=True)
elif report_name == "other-parties":
module.AccountingZuite_createReportOtherPartiesDataset(with_ledger=False)
elif report_name == "other-parties-ledger":
module.AccountingZuite_createReportOtherPartiesDataset()
elif report_name == "aged-balance":
module.AccountingZuite_createReportAgedBalanceDataset()
else:
raise RuntimeError('Unknown "{}" report - no create*Dataset defined'.format(
report_name))
# test depends on this
return "Accounting Transactions Created."
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>report_name, report_style</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>AccountingZuite_initializeAccountingTransactionReportTest</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -3,7 +3,5 @@ module = portal.accounting_module ...@@ -3,7 +3,5 @@ module = portal.accounting_module
module.manage_delObjects(list(module.objectIds())) module.manage_delObjects(list(module.objectIds()))
module.setProperty('current_content_script', script.getId())
# test depends on this # test depends on this
return "Accounting Transactions Created." return "Accounting Transactions Created."
"""Change the `current_content_script` property on accounting module, """Change the `current_content_script` property on accounting module,
so that the next test knows that we have modified the test data. so that the next test knows that we have modified the test data.
XXX Kato: This is seriously wrong because test must not suppose anything
about the other tests - especially that they did not modify the data.
""" """
context.getPortalObject().accounting_module.setProperty( context.getPortalObject().accounting_module.setProperty(
'current_content_script', 'modified') 'current_content_script', 'modified')
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>AccountingZuite_reportMacros</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
preference = context.portal_preferences.accounting_zuite_preference preference = context.portal_preferences.accounting_zuite_preference
preference.edit(preferred_account_number_method='account_reference') preference.edit(
preferred_account_number_method='account_reference',
preferred_report_style=report_style)
return "Preference Set" return "Preference Set"
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string></string> </value> <value> <string>report_style=\'View\'</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
erp5_invoicing erp5_invoicing
erp5_accounting erp5_accounting
erp5_ui_test erp5_ui_test
\ No newline at end of file erp5_simulation_test
erp5_simplified_invoicing
erp5_configurator_standard_accounting_template
\ No newline at end of file
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