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

Sort by origin in the report



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@11343 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f7c3ae6d
...@@ -103,10 +103,9 @@ for transaction in stool.callSelectionFor(selection_name):\n ...@@ -103,10 +103,9 @@ for transaction in stool.callSelectionFor(selection_name):\n
total = account.setdefault(origin, 0)\n total = account.setdefault(origin, 0)\n
account[origin] = total + (line.total_price or 0)\n account[origin] = total + (line.total_price or 0)\n
# per origin and sheet \n # per origin and sheet \n
account = per_origin_and_sheet_cache.setdefault(\n origin_cache = per_origin_and_sheet_cache.setdefault(origin, {})\n
line.node_relative_url, {})\n total = origin_cache.setdefault((line.node_relative_url, sheet), 0)\n
total = account.setdefault((origin, sheet), 0)\n origin_cache[(line.node_relative_url, sheet)] = total + (line.total_price or 0)\n
account[(origin, sheet)] = total + (line.total_price or 0)\n
\n \n
return line_list\n return line_list\n
</string> </value> </string> </value>
...@@ -177,6 +176,7 @@ return line_list\n ...@@ -177,6 +176,7 @@ return line_list\n
<string>account</string> <string>account</string>
<string>total</string> <string>total</string>
<string>_write_</string> <string>_write_</string>
<string>origin_cache</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -75,14 +75,15 @@ portal = context.getPortalObject()\n ...@@ -75,14 +75,15 @@ portal = context.getPortalObject()\n
total_debit = 0\n total_debit = 0\n
total_credit = 0\n total_credit = 0\n
\n \n
account_cache = cache_storage[\'m9_report_per_origin_and_sheet_summary\']\n origin_cache = cache_storage[\'m9_report_per_origin_and_sheet_summary\']\n
account_list = account_cache.keys()\n origin_list = origin_cache.keys()\n
account_list.sort()\n origin_list.sort()\n
\n \n
for account_url in account_list:\n for origin in origin_list:\n
values = account_cache[account_url]\n values = origin_cache[origin]\n
account_title = portal.restrictedTraverse(account_url).Account_getFormattedTitle()\n for (account_url, sheet), total_price in values.items():\n
for (origin, sheet), total_price in values.items():\n account_title = portal.restrictedTraverse(account_url\n
).Account_getFormattedTitle()\n
debit = max(total_price, 0)\n debit = max(total_price, 0)\n
total_debit += debit\n total_debit += debit\n
credit = -min(total_price, 0)\n credit = -min(total_price, 0)\n
...@@ -156,15 +157,15 @@ return line_list\n ...@@ -156,15 +157,15 @@ return line_list\n
<string>total_debit</string> <string>total_debit</string>
<string>total_credit</string> <string>total_credit</string>
<string>_getitem_</string> <string>_getitem_</string>
<string>account_cache</string> <string>origin_cache</string>
<string>account_list</string> <string>origin_list</string>
<string>_getiter_</string> <string>_getiter_</string>
<string>account_url</string>
<string>values</string>
<string>account_title</string>
<string>origin</string> <string>origin</string>
<string>values</string>
<string>account_url</string>
<string>sheet</string> <string>sheet</string>
<string>total_price</string> <string>total_price</string>
<string>account_title</string>
<string>max</string> <string>max</string>
<string>debit</string> <string>debit</string>
<string>min</string> <string>min</string>
......
39 40
\ 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