Commit 945a72b9 authored by Jérome Perrin's avatar Jérome Perrin

Big cleanup for trial balance (still some testing to be done)



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13422 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent e9fda605
......@@ -68,86 +68,75 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>""" Trial balance.\n
<value> <string encoding="cdata"><![CDATA[
""" Trial balance.\n
"""\n
from Products.ERP5Form.Report import ReportSection\n
\n
request = context.REQUEST\n
portal = context.portal_url.getPortalObject()\n
N_ = portal.Base_translateString\n
\n
at_date = request[\'at_date\']\n
section_category = request[\'transaction_section_category\']\n
simulation_state = request[\'transaction_simulation_state\']\n
gap_root = request[\'gap_root\']\n
gap_list = request.get(\'gap_list\' , [])\n
from_date = request.get(\'from_date\' , None)\n
expand_accounts = request.get(\'expand_accounts\' , False)\n
show_parent_accounts = request.get(\'show_parent_accounts\', False)\n
show_balanced_accounts = request[\'show_balanced_accounts\']\n
at_date = request[\'at_date\']\n
from_date = request.get(\'from_date\', None)\n
simulation_state = request[\'simulation_state\']\n
expand_accounts = request.get(\'expand_accounts\', False)\n
show_empty_accounts = request[\'show_empty_accounts\']\n
\n
request.other[\'is_accounting_report\'] = True\n
section_uid = portal.Base_getSectionUidListForSectionCategory(\n
request[\'section_category\'])\n
# XXX for now we guess period start date from the first organisation having\n
# accounting periods\n
period_start_date = None\n
valid_accounting_period = dict(portal_type=\'Accounting Period\',\n
simulation_state=(\'planned\', \'confirmed\',\n
\'stopped\', \'closing\', \'delivered\'))\n
date = from_date or at_date\n
for uid in section_uid:\n
section = portal.portal_catalog.getObject(uid)\n
for ap in section.contentValues(filter=valid_accounting_period):\n
if ap.getStartDate() <= date <= ap.getStopDate():\n
period_start_date = ap.getStartDate().earliestTime()\n
if period_start_date:\n
break\n
else:\n
period_start_date = DateTime(date.year(), 1, 1)\n
request.set(\'period_start_date\', period_start_date)\n
\n
# flat_mode is a boolean that indicate wether we should use a report tree\n
# or a flat list of all accounts.\n
if request.get(\'tree_mode\', False):\n
raise \'Tree mode no longer supported\'\n
\n
result = []\n
params = {\n
\'at_date\' : at_date\n
, \'from_date\' : from_date\n
, \'section_category\' : section_category\n
, \'section_category\' : section_category\n
, \'simulation_state\' : simulation_state\n
, \'accounting_transaction_line_currency\': None\n
, \'is_report_opened\' : True\n
, \'report_depth\' : 5\n
, \'gap_root\' : gap_root\n
, \'gap_list\' : gap_list\n
, \'show_parent_accounts\' : show_parent_accounts\n
, \'expand_accounts\' : expand_accounts\n
, \'show_balanced_accounts\' : show_balanced_accounts\n
}\n
\n
balance_columns = (\n
(\'id\' , \'GAP\')\n
, (\'title\' , \'Account\')\n
, (\'opening_balance\', \'Opening Balance\')\n
, (\'debit_movement\' , \'Debit Movements\')\n
, (\'credit_movement\', \'Credit Movements\')\n
, (\'closing_balance\', \'Closing Balance\')\n
)\n
if not from_date:\n
from_date = period_start_date\n
from_date = (from_date - 1).latestTime()\n
\n
result.append( ReportSection(\n
path = portal.account_module.getPhysicalPath()\n
# FIXME: translate later (?)\n
, title = portal.Localizer.erp5_ui.gettext(\'Trial Balance\').encode(\'utf8\')\n
, level = 1\n
, form_id = \'AccountModule_viewAccountListForTrialBalance\'\n
, selection_name = \'accounting_selection\'\n
, selection_params = params\n
, listbox_display_mode = \'FlatListMode\'\n
, selection_columns = balance_columns\n
))\n
# currency precision\n
currency = portal.Base_getCurrencyForSection(request[\'section_category\'])\n
precision = portal.account_module.getQuantityPrecisionFromResource(currency)\n
request.set(\'precision\', precision)\n
\n
# Add a spacer\n
result.append( ReportSection( path = portal.account_module.getPhysicalPath()\n
, title = \'\\n\'\n
, form_id = None\n
))\n
request.set(\'is_accounting_report\', True)\n
\n
# Add summary lines\n
result.append( ReportSection(\n
path = portal.account_module.getPhysicalPath()\n
, title = \'\'\n
, form_id = \'AccountModule_viewTrialBalanceSummary\'\n
, selection_name = \'account_selection\'\n
, listbox_display_mode = \'FlatListMode\'\n
, selection_params = params\n
))\n
# flat_mode is a boolean that indicate wether we should use a report tree or a\n
# flat list of all accounts.\n
if request.get(\'tree_mode\', False): # TODO\n
raise \'Tree mode no longer supported\'\n
\n
return result\n
</string> </value>
return [ ReportSection(\n
path=portal.account_module.getPhysicalPath(),\n
title=N_(\'Trial Balance\'),\n
level=1,\n
form_id=\'AccountModule_viewAccountListForTrialBalance\',\n
selection_name=\'trial_balance_selection\',\n
selection_params=dict(show_empty_accounts=show_empty_accounts,\n
expand_accounts=expand_accounts,\n
at_date=at_date,\n
from_date=from_date,\n
period_start_date=period_start_date,\n
section_uid=section_uid,\n
simulation_state=simulation_state,\n
precision=precision ),) ]\n
]]></string> </value>
</item>
<item>
<key> <string>_code</string> </key>
......@@ -195,23 +184,28 @@ return result\n
<string>context</string>
<string>request</string>
<string>portal</string>
<string>N_</string>
<string>_getitem_</string>
<string>at_date</string>
<string>section_category</string>
<string>simulation_state</string>
<string>gap_root</string>
<string>gap_list</string>
<string>None</string>
<string>from_date</string>
<string>simulation_state</string>
<string>False</string>
<string>expand_accounts</string>
<string>show_parent_accounts</string>
<string>show_balanced_accounts</string>
<string>show_empty_accounts</string>
<string>section_uid</string>
<string>period_start_date</string>
<string>dict</string>
<string>valid_accounting_period</string>
<string>date</string>
<string>_getiter_</string>
<string>uid</string>
<string>section</string>
<string>ap</string>
<string>DateTime</string>
<string>currency</string>
<string>precision</string>
<string>True</string>
<string>_write_</string>
<string>result</string>
<string>params</string>
<string>balance_columns</string>
</tuple>
</value>
</item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.PythonScripts.PythonScript</string>
<string>PythonScript</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Python_magic</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</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>_body</string> </key>
<value> <string>from Products.PythonScripts.standard import Object\n
request = container.REQUEST\n
\n
initial_debit_balance = request[\'TrialBalance.total_initial_debit_balance\']\n
initial_credit_balance = request[\'TrialBalance.total_initial_credit_balance\']\n
debit = request[\'TrialBalance.debit\']\n
credit = request[\'TrialBalance.credit\']\n
\n
return [ Object( initial_debit_balance=initial_debit_balance,\n
initial_credit_balance=initial_credit_balance,\n
debit=debit,\n
credit=credit,\n
final_debit_balance=initial_debit_balance + debit,\n
final_credit_balance=initial_credit_balance + credit ) ]\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_filepath</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>**kw</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>func_code</string> </key>
<value>
<object>
<klass>
<global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>kw</string>
<string>Products.PythonScripts.standard</string>
<string>Object</string>
<string>_getattr_</string>
<string>container</string>
<string>request</string>
<string>_getitem_</string>
<string>initial_debit_balance</string>
<string>initial_credit_balance</string>
<string>debit</string>
<string>credit</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>AccountModule_statAccountListForTrialBalance</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -79,10 +79,11 @@
<key> <string>Default</string> </key>
<value>
<list>
<string>period_start_date</string>
<string>from_date</string>
<string>at_date</string>
<string>transaction_section_category</string>
<string>transaction_simulation_state</string>
<string>section_category</string>
<string>simulation_state</string>
</list>
</value>
</item>
......
......@@ -194,6 +194,14 @@
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden_day_is_last_day</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hide_day</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>input_order</string> </key>
<value>
......@@ -466,7 +474,7 @@
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>here/REQUEST/at_date</string> </value>
<value> <string>request/at_date | nothing</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -194,6 +194,14 @@
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden_day_is_last_day</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hide_day</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>input_order</string> </key>
<value>
......@@ -466,7 +474,7 @@
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>here/REQUEST/from_date | nothing</string> </value>
<value> <string>request/from_date | nothing</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -14,7 +14,7 @@
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>transaction_section_category</string> </value>
<value> <string>section_category</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
......@@ -279,7 +279,7 @@
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python:here.getPortalObject().portal_categories.resolveCategory(here.REQUEST.transaction_section_category).getLogicalPath()</string> </value>
<value> <string>python:here.getPortalObject().portal_categories.resolveCategory(request[\'section_category\']).getLogicalPath()</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -14,7 +14,7 @@
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>transaction_simulation_state</string> </value>
<value> <string>simulation_state</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
......@@ -317,7 +317,7 @@
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python:[here.Localizer.erp5_ui.gettext(x).encode(\'utf8\') for x in here.REQUEST.get(\'transaction_simulation_state\')]</string> </value>
<value> <string>python:[here.Localizer.erp5_ui.gettext(x).encode(\'utf8\') for x in request[\'simulation_state\']]</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -80,22 +80,18 @@
<item>
<key> <string>center</string> </key>
<value>
<list>
<string>your_gap_root</string>
<string>your_gap_list</string>
</list>
<list/>
</value>
</item>
<item>
<key> <string>left</string> </key>
<value>
<list>
<string>your_transaction_section_category</string>
<string>your_section_category</string>
<string>your_from_date</string>
<string>your_at_date</string>
<string>your_expand_accounts</string>
<string>your_show_parent_accounts</string>
<string>your_show_balanced_accounts</string>
<string>your_show_empty_accounts</string>
<string>your_portal_skin</string>
</list>
</value>
......@@ -104,7 +100,7 @@
<key> <string>right</string> </key>
<value>
<list>
<string>your_transaction_simulation_state</string>
<string>your_simulation_state</string>
</list>
</value>
</item>
......
......@@ -14,7 +14,7 @@
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>your_transaction_section_category</string> </value>
<value> <string>your_section_category</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
......
......@@ -14,7 +14,7 @@
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>your_show_balanced_accounts</string> </value>
<value> <string>your_show_empty_accounts</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
......@@ -163,7 +163,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Show Balanced Accounts</string> </value>
<value> <string>Show Accounts Without Transactions</string> </value>
</item>
</dictionary>
</value>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.Formulator.StandardFields</string>
<string>CheckBoxField</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>your_show_parent_accounts</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 Parents Accounts</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -14,7 +14,7 @@
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>your_transaction_simulation_state</string> </value>
<value> <string>your_simulation_state</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
......@@ -164,7 +164,9 @@
</item>
<item>
<key> <string>size</string> </key>
<value> <string></string> </value>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>title</string> </key>
......@@ -301,4 +303,23 @@
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<tuple>
<tuple>
<string>Products.Formulator.TALESField</string>
<string>TALESMethod</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: len(field.get_value(\'items\'))</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
214
\ No newline at end of file
209
\ 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