Commit 78d1baf1 authored by Jérome Perrin's avatar Jérome Perrin

accounting: Trial Balance: add columns for initial and final balance and hide...

accounting: Trial Balance: add columns for initial and final balance and hide detailed balance columns

Add an option to display detailed balance columns
parent 5ae7e594
...@@ -374,6 +374,8 @@ for node in getInventoryList(\n ...@@ -374,6 +374,8 @@ for node in getInventoryList(\n
**inventory_params):\n **inventory_params):\n
account_props = line_per_account.setdefault(getKey(node), dict(debit=0, credit=0))\n account_props = line_per_account.setdefault(getKey(node), dict(debit=0, credit=0))\n
total_price = node[\'total_price\'] or 0\n total_price = node[\'total_price\'] or 0\n
account_props[\'initial_balance\'] = account_props.get(\n
\'initial_balance\', 0) + total_price\n
account_props[\'initial_debit_balance\'] = account_props.get(\n account_props[\'initial_debit_balance\'] = account_props.get(\n
\'initial_debit_balance\', 0) + max(total_price, 0)\n \'initial_debit_balance\', 0) + max(total_price, 0)\n
account_props[\'initial_credit_balance\'] = account_props.get(\n account_props[\'initial_credit_balance\'] = account_props.get(\n
...@@ -391,6 +393,8 @@ for node in getInventoryList(\n ...@@ -391,6 +393,8 @@ for node in getInventoryList(\n
**inventory_params):\n **inventory_params):\n
account_props = line_per_account.setdefault(getKey(node), dict(debit=0, credit=0))\n account_props = line_per_account.setdefault(getKey(node), dict(debit=0, credit=0))\n
total_price = node[\'total_price\'] or 0\n total_price = node[\'total_price\'] or 0\n
account_props[\'initial_balance\'] = account_props.get(\n
\'initial_balance\', 0) + total_price\n
account_props[\'initial_debit_balance\'] = account_props.get(\n account_props[\'initial_debit_balance\'] = account_props.get(\n
\'initial_debit_balance\', 0) + max(total_price, 0)\n \'initial_debit_balance\', 0) + max(total_price, 0)\n
account_props[\'initial_credit_balance\'] = account_props.get(\n account_props[\'initial_credit_balance\'] = account_props.get(\n
...@@ -679,10 +683,12 @@ for key, data in line_per_account.items():\n ...@@ -679,10 +683,12 @@ for key, data in line_per_account.items():\n
node_title=node_title,\n node_title=node_title,\n
mirror_section_title=mirror_section_title,\n mirror_section_title=mirror_section_title,\n
node_relative_url=node_relative_url,\n node_relative_url=node_relative_url,\n
initial_balance=initial_debit_balance - initial_credit_balance,\n
initial_debit_balance=initial_debit_balance,\n initial_debit_balance=initial_debit_balance,\n
initial_credit_balance=initial_credit_balance,\n initial_credit_balance=initial_credit_balance,\n
debit=data[\'debit\'],\n debit=data[\'debit\'],\n
credit=data[\'credit\'],\n credit=data[\'credit\'],\n
final_balance=final_debit_balance - final_credit_balance,\n
final_debit_balance=final_debit_balance,\n final_debit_balance=final_debit_balance,\n
final_credit_balance=final_credit_balance,\n final_credit_balance=final_credit_balance,\n
final_balance_if_debit=max(closing_balance, 0),\n final_balance_if_debit=max(closing_balance, 0),\n
...@@ -774,6 +780,7 @@ for account_class in account_class_list:\n ...@@ -774,6 +780,7 @@ for account_class in account_class_list:\n
# summary\n # summary\n
add_line(Object(node_title=Base_translateString(\'Total for class ${account_class}\',\n add_line(Object(node_title=Base_translateString(\'Total for class ${account_class}\',\n
mapping=dict(account_class=account_class or \'???\')),\n mapping=dict(account_class=account_class or \'???\')),\n
initial_balance=round(initial_debit_balance - initial_credit_balance, precision),\n
initial_debit_balance=round(initial_debit_balance, precision),\n initial_debit_balance=round(initial_debit_balance, precision),\n
debit=round(debit, precision),\n debit=round(debit, precision),\n
final_debit_balance=round(final_debit_balance, precision),\n final_debit_balance=round(final_debit_balance, precision),\n
...@@ -781,7 +788,8 @@ for account_class in account_class_list:\n ...@@ -781,7 +788,8 @@ for account_class in account_class_list:\n
credit=round(credit, precision),\n credit=round(credit, precision),\n
final_credit_balance=round(final_credit_balance, precision),\n final_credit_balance=round(final_credit_balance, precision),\n
final_balance_if_debit=round(final_balance_if_debit, precision),\n final_balance_if_debit=round(final_balance_if_debit, precision),\n
final_balance_if_credit=round(final_balance_if_credit, precision),))\n final_balance_if_credit=round(final_balance_if_credit, precision),\n
final_balance=round(final_debit_balance - final_credit_balance, precision),))\n
\n \n
add_line(Object(node_title=\' \'))\n add_line(Object(node_title=\' \'))\n
\n \n
......
...@@ -56,7 +56,6 @@ from Products.ERP5Form.Report import ReportSection\n ...@@ -56,7 +56,6 @@ from Products.ERP5Form.Report import ReportSection\n
\n \n
request = context.REQUEST\n request = context.REQUEST\n
portal = context.portal_url.getPortalObject()\n portal = context.portal_url.getPortalObject()\n
N_ = portal.Base_translateString\n
\n \n
at_date = request[\'at_date\']\n at_date = request[\'at_date\']\n
from_date = request.get(\'from_date\', None)\n from_date = request.get(\'from_date\', None)\n
...@@ -70,6 +69,7 @@ show_empty_accounts = request[\'show_empty_accounts\']\n ...@@ -70,6 +69,7 @@ show_empty_accounts = request[\'show_empty_accounts\']\n
per_account_class_summary = request[\'per_account_class_summary\']\n per_account_class_summary = request[\'per_account_class_summary\']\n
gap_root = request.get(\'gap_root\', None)\n gap_root = request.get(\'gap_root\', None)\n
mirror_section_category = request.get(\'mirror_section_category_list\', None)\n mirror_section_category = request.get(\'mirror_section_category_list\', None)\n
show_detailed_balance_columns = request[\'show_detailed_balance_columns\']\n
section_uid = portal.Base_getSectionUidListForSectionCategory(\n section_uid = portal.Base_getSectionUidListForSectionCategory(\n
request[\'section_category\'],\n request[\'section_category\'],\n
request[\'section_category_strict\'])\n request[\'section_category_strict\'])\n
...@@ -130,19 +130,33 @@ for analytic in group_analytic:\n ...@@ -130,19 +130,33 @@ for analytic in group_analytic:\n
extra_columns += ((uid_key, analytic_column[1]),)\n extra_columns += ((uid_key, analytic_column[1]),)\n
\n \n
\n \n
selection_columns = (\n if show_detailed_balance_columns:\n
selection_columns = (\n
(\'node_id\', \'GAP Account ID\'),\n (\'node_id\', \'GAP Account ID\'),\n
(\'node_title\', \'Account Name\'),\n (\'node_title\', \'Account Name\'),\n
) + extra_columns + (\n ) + extra_columns + (\n
(\'initial_debit_balance\', \'Initial Debit Balance\'),\n (\'initial_debit_balance\', \'Initial Debit Balance\'),\n
(\'initial_credit_balance\', \'Initial Credit Balance\'),\n (\'initial_credit_balance\', \'Initial Credit Balance\'),\n
(\'initial_balance\', \'Initial Balance\'),\n
(\'debit\', \'Debit Transactions\'),\n (\'debit\', \'Debit Transactions\'),\n
(\'credit\', \'Credit Transactions\'),\n (\'credit\', \'Credit Transactions\'),\n
(\'final_debit_balance\', \'Final Debit Balance\'),\n (\'final_debit_balance\', \'Final Debit Balance\'),\n
(\'final_credit_balance\', \'Final Credit Balance\'),\n (\'final_credit_balance\', \'Final Credit Balance\'),\n
(\'final_balance\', \'Final Balance\'),\n
(\'final_balance_if_debit\', \'Final Balance (Debit)\'),\n (\'final_balance_if_debit\', \'Final Balance (Debit)\'),\n
(\'final_balance_if_credit\', \'Final Balance (Credit)\'),\n (\'final_balance_if_credit\', \'Final Balance (Credit)\'),\n
)\n )\n
else:\n
selection_columns = (\n
(\'node_id\', \'GAP Account ID\'),\n
(\'node_title\', \'Account Name\'),\n
) + extra_columns + (\n
(\'initial_balance\', \'Initial Balance\'),\n
(\'debit\', \'Debit Transactions\'),\n
(\'credit\', \'Credit Transactions\'),\n
(\'final_balance\', \'Final Balance\'),\n
)\n
\n
return [ ReportSection(\n return [ ReportSection(\n
path=portal.account_module.getPhysicalPath(),\n path=portal.account_module.getPhysicalPath(),\n
form_id=\'AccountModule_viewAccountListForTrialBalance\',\n form_id=\'AccountModule_viewAccountListForTrialBalance\',\n
......
...@@ -62,8 +62,10 @@ final_balance_if_credit = request[\'TrialBalance.final_balance_if_credit\']\n ...@@ -62,8 +62,10 @@ final_balance_if_credit = request[\'TrialBalance.final_balance_if_credit\']\n
\n \n
return [ Object( initial_debit_balance=initial_debit_balance,\n return [ Object( initial_debit_balance=initial_debit_balance,\n
initial_credit_balance=initial_credit_balance,\n initial_credit_balance=initial_credit_balance,\n
initial_balance=initial_debit_balance-initial_credit_balance,\n
debit=debit,\n debit=debit,\n
credit=credit,\n credit=credit,\n
final_balance=(initial_debit_balance + debit) - (initial_credit_balance + credit),\n
final_debit_balance=initial_debit_balance + debit,\n final_debit_balance=initial_debit_balance + debit,\n
final_credit_balance=initial_credit_balance + credit,\n final_credit_balance=initial_credit_balance + credit,\n
final_balance_if_debit=final_balance_if_debit,\n final_balance_if_debit=final_balance_if_debit,\n
......
...@@ -88,6 +88,8 @@ ...@@ -88,6 +88,8 @@
<string>listbox_final_debit_balance</string> <string>listbox_final_debit_balance</string>
<string>listbox_final_balance_if_credit</string> <string>listbox_final_balance_if_credit</string>
<string>listbox_final_balance_if_debit</string> <string>listbox_final_balance_if_debit</string>
<string>listbox_final_balance</string>
<string>listbox_initial_balance</string>
</list> </list>
</value> </value>
</item> </item>
......
...@@ -323,6 +323,10 @@ ...@@ -323,6 +323,10 @@
<key> <string>alternate_name</string> </key> <key> <string>alternate_name</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>anchor</string> </key>
<value> <int>0</int> </value>
</item>
<item> <item>
<key> <string>columns</string> </key> <key> <string>columns</string> </key>
<value> <value>
...@@ -335,6 +339,10 @@ ...@@ -335,6 +339,10 @@
<string>node_title</string> <string>node_title</string>
<string>Account Name</string> <string>Account Name</string>
</tuple> </tuple>
<tuple>
<string>initial_balance</string>
<string>Initial Balance</string>
</tuple>
<tuple> <tuple>
<string>initial_debit_balance</string> <string>initial_debit_balance</string>
<string>Initial Debit Balance</string> <string>Initial Debit Balance</string>
...@@ -351,6 +359,10 @@ ...@@ -351,6 +359,10 @@
<string>credit</string> <string>credit</string>
<string>Credit Transactions</string> <string>Credit Transactions</string>
</tuple> </tuple>
<tuple>
<string>final_balance</string>
<string>Final Balance</string>
</tuple>
<tuple> <tuple>
<string>final_debit_balance</string> <string>final_debit_balance</string>
<string>Final Debit Balance</string> <string>Final Debit Balance</string>
...@@ -382,6 +394,10 @@ ...@@ -382,6 +394,10 @@
<key> <string>default</string> </key> <key> <string>default</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>default_display_style</string> </key>
<value> <string>table</string> </value>
</item>
<item> <item>
<key> <string>default_params</string> </key> <key> <string>default_params</string> </key>
<value> <value>
...@@ -392,6 +408,12 @@ ...@@ -392,6 +408,12 @@
<key> <string>description</string> </key> <key> <string>description</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>display_style_list</string> </key>
<value>
<list/>
</value>
</item>
<item> <item>
<key> <string>domain_root_list</string> </key> <key> <string>domain_root_list</string> </key>
<value> <value>
...@@ -410,6 +432,10 @@ ...@@ -410,6 +432,10 @@
<key> <string>editable_columns</string> </key> <key> <string>editable_columns</string> </key>
<value> <value>
<list> <list>
<tuple>
<string>initial_balance</string>
<string>Initial Balance</string>
</tuple>
<tuple> <tuple>
<string>initial_debit_balance</string> <string>initial_debit_balance</string>
<string>Initial Debit Balance</string> <string>Initial Debit Balance</string>
...@@ -426,6 +452,10 @@ ...@@ -426,6 +452,10 @@
<string>credit</string> <string>credit</string>
<string>Credit Transactions</string> <string>Credit Transactions</string>
</tuple> </tuple>
<tuple>
<string>final_balance</string>
<string>Final Balance</string>
</tuple>
<tuple> <tuple>
<string>final_debit_balance</string> <string>final_debit_balance</string>
<string>Final Debit Balance</string> <string>Final Debit Balance</string>
...@@ -459,10 +489,18 @@ ...@@ -459,10 +489,18 @@
<list/> <list/>
</value> </value>
</item> </item>
<item>
<key> <string>global_search_column</string> </key>
<value> <string></string> </value>
</item>
<item> <item>
<key> <string>hidden</string> </key> <key> <string>hidden</string> </key>
<value> <int>0</int> </value> <value> <int>0</int> </value>
</item> </item>
<item>
<key> <string>hide_rows_on_no_search_criterion</string> </key>
<value> <int>0</int> </value>
</item>
<item> <item>
<key> <string>lines</string> </key> <key> <string>lines</string> </key>
<value> <int>25</int> </value> <value> <int>25</int> </value>
...@@ -483,6 +521,10 @@ ...@@ -483,6 +521,10 @@
<list/> <list/>
</value> </value>
</item> </item>
<item>
<key> <string>page_navigation_template</string> </key>
<value> <string>ListBox_viewSliderPageNavigationRenderer</string> </value>
</item>
<item> <item>
<key> <string>page_template</string> </key> <key> <string>page_template</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
...@@ -503,6 +545,10 @@ ...@@ -503,6 +545,10 @@
<key> <string>report_tree</string> </key> <key> <string>report_tree</string> </key>
<value> <int>0</int> </value> <value> <int>0</int> </value>
</item> </item>
<item>
<key> <string>row_css_method</string> </key>
<value> <string></string> </value>
</item>
<item> <item>
<key> <string>search</string> </key> <key> <string>search</string> </key>
<value> <int>0</int> </value> <value> <int>0</int> </value>
...@@ -545,10 +591,22 @@ ...@@ -545,10 +591,22 @@
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
<item>
<key> <string>style_columns</string> </key>
<value>
<list/>
</value>
</item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Accounts</string> </value> <value> <string>Accounts</string> </value>
</item> </item>
<item>
<key> <string>untranslatable_columns</string> </key>
<value>
<list/>
</value>
</item>
<item> <item>
<key> <string>url_columns</string> </key> <key> <string>url_columns</string> </key>
<value> <value>
......
...@@ -93,6 +93,7 @@ ...@@ -93,6 +93,7 @@
<string>your_group_analytic</string> <string>your_group_analytic</string>
<string>your_show_empty_accounts</string> <string>your_show_empty_accounts</string>
<string>your_per_account_class_summary</string> <string>your_per_account_class_summary</string>
<string>your_show_detailed_balance_columns</string>
<string>your_portal_skin</string> <string>your_portal_skin</string>
<string>your_format</string> <string>your_format</string>
<string>your_deferred_style</string> <string>your_deferred_style</string>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="CheckBoxField" module="Products.Formulator.StandardFields"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>your_show_detailed_balance_columns</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Show Detailed Balance Columns</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
This diff is collapsed.
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