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

Add a new parameter in trial balance to have intermediate sums

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17352 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent fc516242
...@@ -3,11 +3,8 @@ ...@@ -3,11 +3,8 @@
<record id="1" aka="AAAAAAAAAAE="> <record id="1" aka="AAAAAAAAAAE=">
<pickle> <pickle>
<tuple> <tuple>
<tuple> <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<string>Products.PythonScripts.PythonScript</string> <tuple/>
<string>PythonScript</string>
</tuple>
<none/>
</tuple> </tuple>
</pickle> </pickle>
<pickle> <pickle>
...@@ -634,7 +631,69 @@ request.set(\'TrialBalance.debit\', total_debit)\n ...@@ -634,7 +631,69 @@ request.set(\'TrialBalance.debit\', total_debit)\n
request.set(\'TrialBalance.credit\', total_credit)\n request.set(\'TrialBalance.credit\', total_credit)\n
request.set(\'TrialBalance.final_balance_if_debit\', total_final_balance_if_debit)\n request.set(\'TrialBalance.final_balance_if_debit\', total_final_balance_if_debit)\n
request.set(\'TrialBalance.final_balance_if_credit\', total_final_balance_if_credit)\n request.set(\'TrialBalance.final_balance_if_credit\', total_final_balance_if_credit)\n
return line_list\n \n
if not per_account_class_summary:\n
return line_list\n
\n
current_gap = portal.portal_preferences.getPreferredAccountingTransactionGap()\n
if current_gap.startswith(\'gap/\'):\n
current_gap = current_gap[4:]\n
def getAccountClass(account_relative_url):\n
account = traverse(account_relative_url)\n
for gap in account.getGapList():\n
if gap.startswith(current_gap):\n
gap_part_list = gap.split(\'/\')\n
# country / accounting principle / ${class}\n
if len(gap_part_list) > 2:\n
return gap_part_list[2]\n
return None # this account has no class on the current GAP \n
\n
new_line_list = []\n
account_per_class = dict()\n
for brain in line_list:\n
account_per_class.setdefault(\n
getAccountClass(brain.node_relative_url), []).append(brain)\n
\n
account_class_list = account_per_class.keys()\n
account_class_list.sort()\n
\n
add_line = new_line_list.append\n
for account_class in account_class_list:\n
initial_debit_balance = 0\n
debit = 0\n
final_debit_balance = 0\n
initial_credit_balance = 0\n
credit = 0\n
final_credit_balance = 0\n
final_balance_if_debit = 0\n
final_balance_if_credit = 0\n
\n
for account in account_per_class[account_class]:\n
initial_debit_balance += account.initial_debit_balance\n
debit += account.debit\n
final_debit_balance += account.final_debit_balance\n
initial_credit_balance += account.initial_credit_balance\n
credit += account.credit\n
final_credit_balance += account.final_credit_balance\n
final_balance_if_debit += account.final_balance_if_debit\n
final_balance_if_credit += account.final_balance_if_credit\n
add_line(account)\n
\n
# summary\n
add_line(Object(node_title=N_(\'Total for class ${account_class}\',\n
mapping=dict(account_class=account_class or \'???\')),\n
initial_debit_balance=round(initial_debit_balance, precision),\n
debit=round(debit, precision),\n
final_debit_balance=round(final_debit_balance, precision),\n
initial_credit_balance=round(initial_credit_balance, precision),\n
credit=round(credit, 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_credit=round(final_balance_if_credit, precision),))\n
\n
add_line(Object(node_title=\' \'))\n
\n
return new_line_list\n
# vim: foldmethod=marker\n # vim: foldmethod=marker\n
...@@ -660,7 +719,7 @@ return line_list\n ...@@ -660,7 +719,7 @@ return line_list\n
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>show_empty_accounts, expand_accounts, at_date, from_date, period_start_date, section_uid, simulation_state, precision, node_uid, **kw</string> </value> <value> <string>show_empty_accounts, expand_accounts, at_date, from_date, period_start_date, section_uid, simulation_state, precision, node_uid, per_account_class_summary=0, **kw</string> </value>
</item> </item>
<item> <item>
<key> <string>errors</string> </key> <key> <string>errors</string> </key>
...@@ -680,7 +739,7 @@ return line_list\n ...@@ -680,7 +739,7 @@ return line_list\n
<dictionary> <dictionary>
<item> <item>
<key> <string>co_argcount</string> </key> <key> <string>co_argcount</string> </key>
<value> <int>9</int> </value> <value> <int>10</int> </value>
</item> </item>
<item> <item>
<key> <string>co_varnames</string> </key> <key> <string>co_varnames</string> </key>
...@@ -695,6 +754,7 @@ return line_list\n ...@@ -695,6 +754,7 @@ return line_list\n
<string>simulation_state</string> <string>simulation_state</string>
<string>precision</string> <string>precision</string>
<string>node_uid</string> <string>node_uid</string>
<string>per_account_class_summary</string>
<string>kw</string> <string>kw</string>
<string>Products.PythonScripts.standard</string> <string>Products.PythonScripts.standard</string>
<string>Object</string> <string>Object</string>
...@@ -736,6 +796,7 @@ return line_list\n ...@@ -736,6 +796,7 @@ return line_list\n
<string>_getitem_</string> <string>_getitem_</string>
<string>account_props</string> <string>account_props</string>
<string>total_price</string> <string>total_price</string>
<string>_inplacevar_</string>
<string>round</string> <string>round</string>
<string>max</string> <string>max</string>
<string>traverse</string> <string>traverse</string>
...@@ -762,6 +823,19 @@ return line_list\n ...@@ -762,6 +823,19 @@ return line_list\n
<string>closing_balance</string> <string>closing_balance</string>
<string>line</string> <string>line</string>
<string>getStringIndex</string> <string>getStringIndex</string>
<string>current_gap</string>
<string>getAccountClass</string>
<string>new_line_list</string>
<string>account_per_class</string>
<string>brain</string>
<string>account_class_list</string>
<string>add_line</string>
<string>account_class</string>
<string>debit</string>
<string>credit</string>
<string>final_balance_if_debit</string>
<string>final_balance_if_credit</string>
<string>account</string>
</tuple> </tuple>
</value> </value>
</item> </item>
...@@ -773,7 +847,9 @@ return line_list\n ...@@ -773,7 +847,9 @@ return line_list\n
<item> <item>
<key> <string>func_defaults</string> </key> <key> <string>func_defaults</string> </key>
<value> <value>
<none/> <tuple>
<int>0</int>
</tuple>
</value> </value>
</item> </item>
<item> <item>
......
...@@ -3,11 +3,8 @@ ...@@ -3,11 +3,8 @@
<record id="1" aka="AAAAAAAAAAE="> <record id="1" aka="AAAAAAAAAAE=">
<pickle> <pickle>
<tuple> <tuple>
<tuple> <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<string>Products.PythonScripts.PythonScript</string> <tuple/>
<string>PythonScript</string>
</tuple>
<none/>
</tuple> </tuple>
</pickle> </pickle>
<pickle> <pickle>
...@@ -81,6 +78,7 @@ from_date = request.get(\'from_date\', None)\n ...@@ -81,6 +78,7 @@ from_date = request.get(\'from_date\', None)\n
simulation_state = request[\'simulation_state\']\n simulation_state = request[\'simulation_state\']\n
expand_accounts = request.get(\'expand_accounts\', False)\n expand_accounts = request.get(\'expand_accounts\', False)\n
show_empty_accounts = request[\'show_empty_accounts\']\n show_empty_accounts = request[\'show_empty_accounts\']\n
per_account_class_summary = request[\'per_account_class_summary\']\n
\n \n
section_uid = portal.Base_getSectionUidListForSectionCategory(\n section_uid = portal.Base_getSectionUidListForSectionCategory(\n
request[\'section_category\'])\n request[\'section_category\'])\n
...@@ -128,7 +126,9 @@ return [ ReportSection(\n ...@@ -128,7 +126,9 @@ return [ ReportSection(\n
section_uid=section_uid,\n section_uid=section_uid,\n
simulation_state=simulation_state,\n simulation_state=simulation_state,\n
precision=precision,\n precision=precision,\n
node_uid=node_uid), )]\n node_uid=node_uid,\n
per_account_class_summary=\n
per_account_class_summary), )]\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
...@@ -192,6 +192,7 @@ return [ ReportSection(\n ...@@ -192,6 +192,7 @@ return [ ReportSection(\n
<string>False</string> <string>False</string>
<string>expand_accounts</string> <string>expand_accounts</string>
<string>show_empty_accounts</string> <string>show_empty_accounts</string>
<string>per_account_class_summary</string>
<string>section_uid</string> <string>section_uid</string>
<string>period_start_date</string> <string>period_start_date</string>
<string>currency</string> <string>currency</string>
......
...@@ -77,8 +77,8 @@ ...@@ -77,8 +77,8 @@
<value> <value>
<list> <list>
<string>your_period_start_date</string> <string>your_period_start_date</string>
<string>your_at_date</string>
<string>your_from_date</string> <string>your_from_date</string>
<string>your_at_date</string>
<string>your_section_category</string> <string>your_section_category</string>
<string>your_simulation_state</string> <string>your_simulation_state</string>
</list> </list>
......
...@@ -91,6 +91,7 @@ ...@@ -91,6 +91,7 @@
<string>your_at_date</string> <string>your_at_date</string>
<string>your_expand_accounts</string> <string>your_expand_accounts</string>
<string>your_show_empty_accounts</string> <string>your_show_empty_accounts</string>
<string>your_per_account_class_summary</string>
<string>your_portal_skin</string> <string>your_portal_skin</string>
<string>your_format</string> <string>your_format</string>
</list> </list>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="CheckBoxField" module="Products.Formulator.StandardFields"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>your_per_account_class_summary</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>Summary for each Account Class</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
473 475
\ No newline at end of file \ 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