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

When selecting a payment_mode which is not a leave, display a detail of

transaction for each payment mode inside the selected payment_mode


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13261 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 989ece4f
...@@ -68,7 +68,9 @@ ...@@ -68,7 +68,9 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>"""\n <value> <string encoding="cdata"><![CDATA[
"""\n
"""\n """\n
from Products.ERP5Form.Report import ReportSection\n from Products.ERP5Form.Report import ReportSection\n
request = context.REQUEST\n request = context.REQUEST\n
...@@ -84,15 +86,20 @@ section_category = request[\'section_category\']\n ...@@ -84,15 +86,20 @@ section_category = request[\'section_category\']\n
portal_type = request[\'portal_type\']\n portal_type = request[\'portal_type\']\n
\n \n
payment_mode_url = None\n payment_mode_url = None\n
detail_per_payment_mode = 0\n
payment_mode_request_keys = dict()\n
\n
if portal_type == \'Payment Transaction\':\n if portal_type == \'Payment Transaction\':\n
payment_mode = request.get(\'payment_mode\')\n payment_mode = request.get(\'payment_mode\')\n
if payment_mode:\n if payment_mode:\n
payment_mode_value = portal.portal_categories.payment_mode\\\n payment_mode_value = portal.portal_categories.payment_mode\\\n
.restrictedTraverse(payment_mode)\n .restrictedTraverse(payment_mode)\n
payment_mode_url = payment_mode_value.getRelativeUrl().split(\'/\', 1)[1]\n payment_mode_url = payment_mode_value.getRelativeUrl().split(\'/\', 1)[1]\n
\n detail_per_payment_mode = len(payment_mode_value.contentValues()) > 0\n
for pm in payment_mode_value.contentValues():\n
cache_storage.setdefault(\'m9_report_per_%s\' % pm.getRelativeUrl(), {})\n
\n
simulation_state = [\'delivered\']\n simulation_state = [\'delivered\']\n
\n
selection_name = \'accounting_selection\'\n selection_name = \'accounting_selection\'\n
simtool = context.portal_simulation\n simtool = context.portal_simulation\n
\n \n
...@@ -164,7 +171,19 @@ for brain in simtool.getMovementHistoryList(\n ...@@ -164,7 +171,19 @@ for brain in simtool.getMovementHistoryList(\n
\n \n
total_debit, total_credit = account.get(origin, (0, 0))\n total_debit, total_credit = account.get(origin, (0, 0))\n
account[origin] = ( total_debit + debit, total_credit + credit )\n account[origin] = ( total_debit + debit, total_credit + credit )\n
# per origin and sheet\n \n
# per origin and sheet, detailed per payment mode\n
if detail_per_payment_mode:\n
key = \'m9_report_per_payment_mode/%s\' % mvt.getPaymentMode()\n
if key not in payment_mode_request_keys:\n
payment_mode_request_keys[key] = mvt.getPaymentModeTitle()\n
origin_cache = cache_storage[key].setdefault(brain.node_relative_url, {})\n
total_debit, total_credit = origin_cache.get(\n
(sheet, brain.node_relative_url), (0, 0))\n
origin_cache[(sheet, brain.node_relative_url)] = \\\n
( total_debit + debit,\n
total_credit + credit )\n
# per origin and sheet, global\n
origin_cache = per_origin_and_sheet_cache.setdefault(origin, {})\n origin_cache = per_origin_and_sheet_cache.setdefault(origin, {})\n
total_debit, total_credit = origin_cache.get(\n total_debit, total_credit = origin_cache.get(\n
(sheet, brain.node_relative_url), (0, 0))\n (sheet, brain.node_relative_url), (0, 0))\n
...@@ -177,19 +196,37 @@ for brain in simtool.getMovementHistoryList(\n ...@@ -177,19 +196,37 @@ for brain in simtool.getMovementHistoryList(\n
cache[brain.node_relative_url] = ( total_debit + debit,\n cache[brain.node_relative_url] = ( total_debit + debit,\n
total_credit + credit )\n total_credit + credit )\n
\n \n
report_section_list = [ ReportSection(\n report_section_list = []\n
report_section_list.append(ReportSection(\n
title=N_(\'Transactions\'),\n title=N_(\'Transactions\'),\n
path=context.getPhysicalPath(),\n path=context.getPhysicalPath(),\n
form_id=\'AccountingTransactionModule_viewPerOriginAndSheetSummary\',\n form_id=\'AccountingTransactionModule_viewPerOriginAndSheetSummary\',\n
selection_name=\'accounting_transaction_module_m9_\'\n selection_name=\'accounting_transaction_module_m9_\'\n
\'accounting_transaction_list_report_selection\',\n \'accounting_transaction_list_report_selection\',\n
selection_params={},\n selection_params=dict(cache_key=\'m9_report_per_origin_and_sheet_summary\'),\n
selection_columns=[(\'sheet\', \'Transmission Sheet\'),\n selection_columns=[(\'sheet\', \'Transmission Sheet\'),\n
(\'account_id\', \'Account\'),\n (\'account_id\', \'Account\'),\n
(\'account_title\', \'Account Name\'),\n (\'account_title\', \'Account Name\'),\n
(\'debit\', \'Debit\'),\n (\'debit\', \'Debit\'),\n
(\'credit\', \'Credit\')],\n (\'credit\', \'Credit\')],\n
listbox_display_mode=\'FlatListMode\', )]\n listbox_display_mode=\'FlatListMode\', ))\n
\n
if detail_per_payment_mode:\n
for cache_key, payment_mode_title in payment_mode_request_keys.items():\n
report_section_list.append(ReportSection(\n
title=N_(\'Transactions for Payment Mode ${payment_mode_title}\',\n
mapping=dict(payment_mode_title=payment_mode_title)),\n
path=context.getPhysicalPath(),\n
level=3,\n
form_id=\'AccountingTransactionModule_viewPerOriginAndSheetSummary\',\n
selection_name=\'accounting_transaction_module_m9_\'\n
\'accounting_transaction_list_report_selection\',\n
selection_params=dict(cache_key=cache_key),\n
selection_columns=[(\'account_id\', \'Account\'),\n
(\'account_title\', \'Account Name\'),\n
(\'debit\', \'Debit\'),\n
(\'credit\', \'Credit\')],\n
listbox_display_mode=\'FlatListMode\', ))\n
\n \n
for account_class in range(1, 10):\n for account_class in range(1, 10):\n
account_class = str(account_class)\n account_class = str(account_class)\n
...@@ -207,7 +244,9 @@ for account_class in range(1, 10):\n ...@@ -207,7 +244,9 @@ for account_class in range(1, 10):\n
listbox_display_mode=\'FlatListMode\', ))\n listbox_display_mode=\'FlatListMode\', ))\n
\n \n
return report_section_list\n return report_section_list\n
</string> </value>
]]></string> </value>
</item> </item>
<item> <item>
<key> <string>_code</string> </key> <key> <string>_code</string> </key>
...@@ -271,8 +310,14 @@ return report_section_list\n ...@@ -271,8 +310,14 @@ return report_section_list\n
<string>section_category</string> <string>section_category</string>
<string>portal_type</string> <string>portal_type</string>
<string>payment_mode_url</string> <string>payment_mode_url</string>
<string>detail_per_payment_mode</string>
<string>dict</string>
<string>payment_mode_request_keys</string>
<string>payment_mode</string> <string>payment_mode</string>
<string>payment_mode_value</string> <string>payment_mode_value</string>
<string>len</string>
<string>_getiter_</string>
<string>pm</string>
<string>simulation_state</string> <string>simulation_state</string>
<string>selection_name</string> <string>selection_name</string>
<string>simtool</string> <string>simtool</string>
...@@ -283,7 +328,6 @@ return report_section_list\n ...@@ -283,7 +328,6 @@ return report_section_list\n
<string>getAccountClass</string> <string>getAccountClass</string>
<string>origin_id_cache</string> <string>origin_id_cache</string>
<string>getOriginId</string> <string>getOriginId</string>
<string>_getiter_</string>
<string>brain</string> <string>brain</string>
<string>mvt</string> <string>mvt</string>
<string>origin</string> <string>origin</string>
...@@ -297,13 +341,15 @@ return report_section_list\n ...@@ -297,13 +341,15 @@ return report_section_list\n
<string>total_debit</string> <string>total_debit</string>
<string>total_credit</string> <string>total_credit</string>
<string>_write_</string> <string>_write_</string>
<string>key</string>
<string>origin_cache</string> <string>origin_cache</string>
<string>cache</string> <string>cache</string>
<string>report_section_list</string> <string>report_section_list</string>
<string>cache_key</string>
<string>payment_mode_title</string>
<string>range</string> <string>range</string>
<string>account_class</string> <string>account_class</string>
<string>str</string> <string>str</string>
<string>dict</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -75,7 +75,7 @@ portal = context.getPortalObject()\n ...@@ -75,7 +75,7 @@ portal = context.getPortalObject()\n
total_debit = 0\n total_debit = 0\n
total_credit = 0\n total_credit = 0\n
\n \n
origin_cache = cache_storage[\'m9_report_per_origin_and_sheet_summary\']\n origin_cache = cache_storage[cache_key]\n
origin_list = origin_cache.keys()\n origin_list = origin_cache.keys()\n
origin_list.sort()\n origin_list.sort()\n
\n \n
...@@ -113,9 +113,15 @@ return line_list\n ...@@ -113,9 +113,15 @@ return line_list\n
<none/> <none/>
</value> </value>
</item> </item>
<item>
<key> <string>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>**kw</string> </value> <value> <string>cache_key=\'m9_report_per_origin_and_sheet_summary\', **kw</string> </value>
</item> </item>
<item> <item>
<key> <string>errors</string> </key> <key> <string>errors</string> </key>
...@@ -135,12 +141,13 @@ return line_list\n ...@@ -135,12 +141,13 @@ return line_list\n
<dictionary> <dictionary>
<item> <item>
<key> <string>co_argcount</string> </key> <key> <string>co_argcount</string> </key>
<value> <int>0</int> </value> <value> <int>1</int> </value>
</item> </item>
<item> <item>
<key> <string>co_varnames</string> </key> <key> <string>co_varnames</string> </key>
<value> <value>
<tuple> <tuple>
<string>cache_key</string>
<string>kw</string> <string>kw</string>
<string>Products.PythonScripts.standard</string> <string>Products.PythonScripts.standard</string>
<string>Object</string> <string>Object</string>
...@@ -176,7 +183,9 @@ return line_list\n ...@@ -176,7 +183,9 @@ return line_list\n
<item> <item>
<key> <string>func_defaults</string> </key> <key> <string>func_defaults</string> </key>
<value> <value>
<none/> <tuple>
<string>m9_report_per_origin_and_sheet_summary</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
......
89 84
\ 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