Commit 21025d4d authored by Jérome Perrin's avatar Jérome Perrin

accounting: show mirror account in grouping dialog

A typical problem which prevents grouping is that the line is used in an
internal invoice and while all the conditions for grouping seems OK for
one side, they are not OK for the other side, because the accounts are
different from the mirror side. By showing the mirror account it should
be a bit easier for users to figure out what is wrong.
parent cd53bf06
Pipeline #30466 failed with stage
in 0 seconds
...@@ -96,6 +96,7 @@ ...@@ -96,6 +96,7 @@
<string>listbox_title</string> <string>listbox_title</string>
<string>listbox_credit</string> <string>listbox_credit</string>
<string>listbox_debit</string> <string>listbox_debit</string>
<string>listbox_mirror_node_title</string>
</list> </list>
</value> </value>
</item> </item>
......
...@@ -184,6 +184,10 @@ ...@@ -184,6 +184,10 @@
<string>Movement_getMirrorSectionTitle</string> <string>Movement_getMirrorSectionTitle</string>
<string>Third Party</string> <string>Third Party</string>
</tuple> </tuple>
<tuple>
<string>mirror_node_title</string>
<string>Third Party Account</string>
</tuple>
</list> </list>
</value> </value>
</item> </item>
......
mirror_node_formatted_title = ''
if context.mirror_node_uid:
brain_list = context.getPortalObject().portal_catalog(uid=context.mirror_node_uid, limit=2)
if brain_list:
brain, = brain_list
mirror_node_formatted_title = brain.getObject().Account_getFormattedTitle()
return mirror_node_formatted_title
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="_reconstructor" module="copy_reg"/>
</klass>
<tuple>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
<global name="object" module="__builtin__"/>
<none/>
</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>Brain_getMirrorNodeFormattedTitle</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="_reconstructor" module="copy_reg"/>
</klass>
<tuple>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
<global name="object" module="__builtin__"/>
<none/>
</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_group_dialog_show_mirror_account.html</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>Grouping Dialog show mirror account</title></head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="4">
Grouping Dialog show mirror account
</td></tr>
</thead><tbody tal:define="init_method string:AccountingTransactionModule_createAccountingTransactionList?add_draft_transactions:int=0&internal_transactions:bool=True">
<!-- Setup {{{ -->
<tal:block metal:use-macro="here/Zuite_CommonTemplateForAccountingRenderjsUi/macros/init"/>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/go_to_module_list" />
<tal:block tal:define="click_configuration python: {'text': 'Organisations'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_page_link" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/clear_query" />
<tal:block tal:define="search_query python: 'title: &quot;Client 1&quot;'">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/search_in_form_list" />
</tal:block>
<!-- {{{ Select Client 1 Organisation and use grouping fast input -->
<tal:block tal:define="click_configuration python: {'text': 'Client 1'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_page_link" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tal:block tal:define="click_configuration python: {'text': 'Actions'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_header_link" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tal:block tal:define="click_configuration python: {'text': 'Grouping Reference Fast Input'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_page_link" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_listbox_loaded" />
<!-- }}} -->
<!-- The mode should be 'grouping' by default -->
<tr>
<td>assertValue</td>
<td>//input[@name='field_your_grouping' and @value='grouping']</td>
<td>on</td>
</tr>
<tr>
<td>assertText</td>
<td>//label[contains(text(),"Total Selected Amount")]/../div[1]/</td>
<td>0.00</td>
</tr>
<tr>
<td>select</td>
<td>field_your_node</td>
<td>value=account_module/receivable</td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/update_dialog" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_listbox_loaded" />
<tal:block tal:define="pagination_configuration python: {'header': '(3)', 'footer': '3 Records'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/check_listbox_pagination_text" />
</tal:block>
<tal:block tal:define="line_configuration python: {'line': 1}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/select_listbox_line" />
</tal:block>
<tal:block tal:define="line_configuration python: {'line': 2}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/select_listbox_line" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/submit_dialog" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_listbox_loaded" />
<tal:block tal:define="notification_configuration python: {'class': 'error',
'text': 'Nothing matches.'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_notification" />
</tal:block>
<tr>
<td>assertText</td>
<td>//label[contains(text(),"Total Selected Amount")]/../div[1]/</td>
<td>0.00</td>
</tr>
<!-- the "Third Party Account" columns helps understanding why grouping is refused -->
<tr>
<td>assertText</td>
<td>//div[contains(@data-gadget-url, 'gadget_erp5_field_listbox.html')]//th[10]</td>
<td>Third Party Account</td>
</tr>
<tr>
<td>assertText</td>
<td>//div[contains(@data-gadget-url, 'gadget_erp5_field_listbox.html')]//tbody/tr[1]/td[10]</td>
<td></td>
</tr>
<tr>
<td>assertText</td>
<td>//div[contains(@data-gadget-url, 'gadget_erp5_field_listbox.html')]//tbody/tr[2]/td[10]</td>
<td>40 - Payable</td>
</tr>
<tr>
<td>assertText</td>
<td>//div[contains(@data-gadget-url, 'gadget_erp5_field_listbox.html')]//tbody/tr[3]/td[10]</td>
<td>7 - Goods Sales</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="_reconstructor" module="copy_reg"/>
</klass>
<tuple>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
<global name="object" module="__builtin__"/>
<none/>
</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_group_dialog_show_mirror_account.html</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>Grouping Dialog show mirror account</title></head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="4">
Grouping Dialog show mirror account
</td></tr>
</thead><tbody tal:define="init_method string:AccountingTransactionModule_createAccountingTransactionList?add_draft_transactions:int=0&internal_transactions:bool=True">
<tal:block metal:use-macro="here/ERP5Site_viewAccountingZuiteCommonTemplate/macros/init"/>
<tr>
<td>selectAndWait</td>
<td>select_module</td>
<td>Organisations</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>Folder_show:method</td>
<td></td>
</tr>
<tr>
<td>type</td>
<!-- title -->
<td>//tr[@class='listbox-search-line']/th[2]/input</td>
<td>Client 1</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>//input[@class="listbox-select-action"]</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>link=Client 1</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>//img[@alt='Grouping Reference Fast Input']</td>
<td></td>
</tr>
<tr>
<td>verifySelected</td>
<td>//select[@name='field_your_section_category']</td>
<td>Demo Group</td>
</tr>
<tr>
<td>verifyText</td>
<td>//label[contains(text(),"Total Selected Amount")]/../div[1]/</td>
<td>0.00</td>
</tr>
<tr>
<td>select</td>
<td>field_your_node</td>
<td>label=41 - Receivable</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>//button[@id="dialog_update_button"]</td>
<td></td>
</tr>
<tr>
<td>assertPortalStatusMessage</td>
<td>Updated</td>
<td></td>
</tr>
<tr>
<td>assertText</td>
<td>//span[@class="listbox-current-page-total-number"]</td>
<td>3 records</td>
</tr>
<tr>
<td>click</td>
<td>//tr[@class='listbox-data-line-1 DataB']/td[1]/input</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//tr[@class='listbox-data-line-2 DataA']/td[1]/input</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>//button[@id="dialog_submit_button"]</td>
<td></td>
</tr>
<tr>
<td>assertPortalStatusMessage</td>
<td>Nothing matches.</td>
<td></td>
</tr>
<tr>
<td>verifyText</td>
<td>//label[contains(text(),"Total Selected Amount")]/../div[1]/</td>
<td>0.00</td>
</tr>
<!-- the "Third Party Account" columns helps understanding why grouping is refused -->
<tr>
<td>assertText</td>
<td>//th[@class="listbox-table-header-cell"][10]</td>
<td>Third Party Account</td>
</tr>
<tr>
<td>assertText</td>
<td>//tr[@class='listbox-data-line-0 DataA']/td[11]</td>
<td></td>
</tr>
<tr>
<td>assertText</td>
<td>//tr[@class='listbox-data-line-1 DataB']/td[11]</td>
<td>40 - Payable</td>
</tr>
<tr>
<td>assertText</td>
<td>//tr[@class='listbox-data-line-2 DataA']/td[11]</td>
<td>7 - Goods Sales</td>
</tr>
</tbody></table>
</body>
</html>
\ No newline at end of file
...@@ -13,9 +13,9 @@ business_process = portal.portal_catalog.getResultValue( ...@@ -13,9 +13,9 @@ business_process = portal.portal_catalog.getResultValue(
portal_type='Business Process').getRelativeUrl() portal_type='Business Process').getRelativeUrl()
# if the previous test didn't change input data, no need to recreate content # 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_both_sections_%s' % ( current_script_data_id = '%s_month_count_%s_draft_%s_state_%s_payment_%s_leger_%s_both_sections_%s_internal_transactions_%s' % (
month_count, add_draft_transactions, transaction_state, month_count, add_draft_transactions, transaction_state,
add_related_payments, set_ledger, both_sections, script.getId()) add_related_payments, set_ledger, both_sections, internal_transactions, script.getId())
if accounting_module.getProperty('current_content_script', if accounting_module.getProperty('current_content_script',
'') == current_script_data_id: '') == current_script_data_id:
...@@ -274,6 +274,66 @@ for section in section_list: ...@@ -274,6 +274,66 @@ for section in section_list:
source=getAccountByTitle('Goods Sales'), source=getAccountByTitle('Goods Sales'),
quantity=random.randint(300, 400),) quantity=random.randint(300, 400),)
if internal_transactions:
allowed_accounting_type_list = portal.portal_types['Accounting Transaction Module'].getTypeAllowedContentTypeList()
if 'Internal Invoice Transaction' not in allowed_accounting_type_list:
portal.portal_types['Accounting Transaction Module'].setTypeAllowedContentTypeList(
tuple(allowed_accounting_type_list) + ('Internal Invoice Transaction',))
tr = accounting_module.newContent(
portal_type='Internal Invoice Transaction',
title='Internal Transaction 1',
source_section=getOrganisationByTitle('My Organisation'),
destination_section=getOrganisationByTitle('Client 1'),
created_by_builder=1,
start_date=DateTime(2005, 6, 1),
stop_date=DateTime(2005, 6, 1),
resource=euro_resource,
)
tr.newContent(
portal_type='Internal Invoice Transaction Line',
source=getAccountByTitle('Receivable'),
destination=getAccountByTitle('Payable'),
quantity=100,
)
tr.newContent(
portal_type='Internal Invoice Transaction Line',
source=getAccountByTitle('Goods Sales'),
destination=getAccountByTitle('Goods Purchase'),
quantity=-100,
)
tr.start()
tr.stop()
tr.deliver()
tr = accounting_module.newContent(
portal_type='Internal Invoice Transaction',
title='Internal Transaction 2',
source_section=getOrganisationByTitle('Client 1'),
destination_section=getOrganisationByTitle('My Organisation'),
created_by_builder=1,
start_date=DateTime(2005, 6, 2),
stop_date=DateTime(2005, 6, 2),
resource=euro_resource,
)
tr.newContent(
portal_type='Internal Invoice Transaction Line',
source=getAccountByTitle('Goods Sales'),
destination=getAccountByTitle('Receivable'),
quantity=100,
)
tr.newContent(
portal_type='Internal Invoice Transaction Line',
source=getAccountByTitle('Goods Sales'),
destination=getAccountByTitle('Goods Purchase'),
quantity=-100,
)
tr.start()
tr.stop()
tr.deliver()
accounting_module.setProperty('current_content_script', accounting_module.setProperty('current_content_script',
current_script_data_id) current_script_data_id)
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>month_count=1, add_draft_transactions=1, transaction_state=\'validated\', add_related_payments=0, keep_grouping_reference=0, set_ledger=0, both_sections=0</string> </value> <value> <string>month_count=1, add_draft_transactions=1, transaction_state=\'validated\', add_related_payments=0, keep_grouping_reference=0, set_ledger=0, both_sections=0, internal_transactions=False</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
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