[Erp5-report] r13168 - in /erp5/trunk/bt5/erp5_accounting_l10n_fr_m9: SkinTemplateItem/port...
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Mar 1 23:40:34 CET 2007
Author: jerome
Date: Thu Mar 1 23:40:25 2007
New Revision: 13168
URL: http://svn.erp5.org?rev=13168&view=rev
Log:
display detailed debit & credit, not only the balance
Modified:
erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_getBalanceExplanationReportSectionList.xml
erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_getJournalPerTransmissionSheetReportSectionList.xml
erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_getM9AccountingTransactionLineList.xml
erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_getPerAccountAndOriginSummaryLineList.xml
erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_getPerAccountClassSummaryList.xml
erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_getPerOriginAndSheetSummaryLineList.xml
erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/bt/revision
Modified: erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_getBalanceExplanationReportSectionList.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_getBalanceExplanationReportSectionList.xml?rev=13168&r1=13167&r2=13168&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_getBalanceExplanationReportSectionList.xml (original)
+++ erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_getBalanceExplanationReportSectionList.xml Thu Mar 1 23:40:25 2007
@@ -72,6 +72,7 @@
from Products.PythonScripts.standard import Object\n
portal = context.getPortalObject()\n
request = portal.REQUEST\n
+precision = 2 # XXX M9 use hardcoded precision for now\n
\n
account = request.get(\'account\', \'\')\n
at_date = request[\'at_date\']\n
@@ -146,9 +147,10 @@
transaction = brain.getObject().getParentValue()\n
dunning_info = transaction.SaleInvoiceTransaction_getDunningInfo()\n
\n
- debit = max(brain.total_price, 0)\n
+ qty = round(brain.total_price, precision)\n
+ debit = max(qty, 0)\n
total_debit += debit\n
- credit = max(-brain.total_price, 0)\n
+ credit = max(-qty, 0)\n
total_credit += credit\n
\n
movement_list.append(\n
@@ -251,6 +253,7 @@
<string>context</string>
<string>portal</string>
<string>request</string>
+ <string>precision</string>
<string>account</string>
<string>_getitem_</string>
<string>at_date</string>
@@ -279,6 +282,8 @@
<string>brain</string>
<string>transaction</string>
<string>dunning_info</string>
+ <string>round</string>
+ <string>qty</string>
<string>max</string>
<string>debit</string>
<string>credit</string>
Modified: erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_getJournalPerTransmissionSheetReportSectionList.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_getJournalPerTransmissionSheetReportSectionList.xml?rev=13168&r1=13167&r2=13168&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_getJournalPerTransmissionSheetReportSectionList.xml (original)
+++ erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_getJournalPerTransmissionSheetReportSectionList.xml Thu Mar 1 23:40:25 2007
@@ -75,6 +75,8 @@
cache_storage = request.other\n
portal = context.portal_url.getPortalObject()\n
N_ = portal.Base_translateString\n
+precision = 2 # XXX M9 uses EUR, so we hardcode 2 places for now\n
+\n
\n
at_date = request[\'at_date\']\n
from_date = request.get(\'from_date\', None) or at_date\n
@@ -119,8 +121,23 @@
# fr / m9 / ${classe} / ...\n
classe = account.getGap().split(\'/\')[2]\n
# XXX this can raise with bad account. add a constraint checker on accounts\n
+ # XXX also this only work if you have only m9 installed. But anyway, it\'s\n
+ # not planned to support m9 and other accounting version on the same\n
+ # instance.\n
account_class_cache[account_url] = classe\n
return classe\n
+\n
+origin_id_cache = {}\n
+def getOriginId(origin_url):\n
+ try:\n
+ return origin_id_cache[origin_url]\n
+ except KeyError:\n
+ origin = portal.portal_categories.origin.restrictedTraverse(origin_url)\n
+ origin_id = origin.getId()\n
+ if origin_id in portal.portal_types.objectIds():\n
+ origin_id = \'\'\n
+ origin_id_cache[origin_url] = origin_id\n
+ return origin_id\n
\n
for brain in simtool.getMovementHistoryList(\n
from_date=from_date.earliestTime(),\n
@@ -133,23 +150,32 @@
if payment_mode_url and not \\\n
mvt.getPaymentMode(\'\').startswith(payment_mode_url):\n
continue\n
- origin = mvt.getOriginId()\n
- sheet = mvt.getParentValue().getAggregateTitle(portal_type=\'Invoice Transmission Sheet\')\n
+\n
+ origin = getOriginId(mvt.getOrigin())\n
+ sheet = mvt.getParentValue().getAggregateTitle(\n
+ portal_type=\'Invoice Transmission Sheet\')\n
if brain.node_relative_url:\n
# per account and origin\n
account = per_account_and_origin_cache.setdefault(\n
brain.node_relative_url, {})\n
- qty = brain.total_price or 0\n
- total = account.setdefault(origin, 0)\n
- account[origin] = total + qty\n
+ qty = round(brain.total_price or 0, precision)\n
+ debit = max(qty, 0)\n
+ credit = max(-qty, 0)\n
+\n
+ total_debit, total_credit = account.get(origin, (0, 0))\n
+ account[origin] = ( total_debit + debit, total_credit + credit )\n
# per origin and sheet\n
origin_cache = per_origin_and_sheet_cache.setdefault(origin, {})\n
- total = origin_cache.get((sheet, brain.node_relative_url), 0)\n
- origin_cache[(sheet, brain.node_relative_url)] = total + qty\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 account class\n
cache = per_account_cache[getAccountClass(brain.node_relative_url)]\n
- total = cache.get(brain.node_relative_url, 0)\n
- cache[brain.node_relative_url] = total + qty\n
+ total_debit, total_credit = cache.get(brain.node_relative_url, (0, 0))\n
+ cache[brain.node_relative_url] = ( total_debit + debit,\n
+ total_credit + credit )\n
\n
report_section_list = [ ReportSection(\n
title=N_(\'Transactions\'),\n
@@ -237,6 +263,7 @@
<string>cache_storage</string>
<string>portal</string>
<string>N_</string>
+ <string>precision</string>
<string>_getitem_</string>
<string>at_date</string>
<string>None</string>
@@ -254,14 +281,21 @@
<string>per_account_cache</string>
<string>account_class_cache</string>
<string>getAccountClass</string>
+ <string>origin_id_cache</string>
+ <string>getOriginId</string>
<string>_getiter_</string>
<string>brain</string>
<string>mvt</string>
<string>origin</string>
<string>sheet</string>
<string>account</string>
+ <string>round</string>
<string>qty</string>
- <string>total</string>
+ <string>max</string>
+ <string>debit</string>
+ <string>credit</string>
+ <string>total_debit</string>
+ <string>total_credit</string>
<string>_write_</string>
<string>origin_cache</string>
<string>cache</string>
Modified: erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_getM9AccountingTransactionLineList.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_getM9AccountingTransactionLineList.xml?rev=13168&r1=13167&r2=13168&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_getM9AccountingTransactionLineList.xml (original)
+++ erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_getM9AccountingTransactionLineList.xml Thu Mar 1 23:40:25 2007
@@ -73,17 +73,16 @@
cache_storage = context.REQUEST.other\n
selection_name = \'accounting_selection\'\n
accounting_movement_type_list = context.getPortalAccountingMovementTypeList()\n
-\n
-stool = context.getPortalObject().portal_selections\n
+precision = 2 # XXX M9 uses EUR for now\n
+\n
+portal = context.getPortalObject()\n
+stool = portal.portal_selections\n
selection = stool.getSelectionFor(selection_name)\n
per_account_and_origin_cache = cache_storage.setdefault(\n
\'m9_report_per_account_and_origin_summary\', {})\n
per_origin_and_sheet_cache = cache_storage.setdefault(\n
\'m9_report_per_origin_and_sheet_summary\', {})\n
\n
-simtool = context.portal_simulation\n
-# FIXME: how to pass pass parameter in the selection without\n
-# making them persistent ?\n
context.REQUEST.other[\'src__\'] = 1\n
context.REQUEST.other[\'no_limit\'] = 1\n
context.REQUEST.other[\'search_result_keys\'] = [\'catalog.uid\']\n
@@ -97,9 +96,21 @@
payment_mode_cache[payment_mode] = category_title\n
return category_title\n
\n
+origin_id_cache = {}\n
+def getOriginId(origin_url):\n
+ try:\n
+ return origin_id_cache[origin_url]\n
+ except KeyError:\n
+ origin = portal.portal_categories.origin.restrictedTraverse(origin_url)\n
+ origin_id = origin.getId()\n
+ if origin_id in portal.portal_types.objectIds():\n
+ origin_id = \'\'\n
+ origin_id_cache[origin_url] = origin_id\n
+ return origin_id\n
+\n
# call getMovementHistory by building a subquery with accounting module\n
# selection\'s query, using the src__=1 trick from above\n
-for brain in simtool.getMovementHistoryList(\n
+for brain in portal.portal_simulation.getMovementHistoryList(\n
where_expression="catalog.parent_uid IN (%s)" %\n
stool.callSelectionFor(selection_name),\n
section_category=selection.getParams().get(\'section_category\'),\n
@@ -109,14 +120,18 @@
\n
movement = brain.getObject()\n
transaction = movement.getParentValue()\n
- origin = transaction.getProperty(\'origin_id\')\n
+ origin = getOriginId(transaction.getProperty(\'origin\'))\n
sheet = transaction.getProperty(\'aggregate_title\')\n
payment_mode_codification = getPaymentModeCodification(\n
transaction.getPaymentMode())\n
+ qty = round((brain.total_price or 0), precision)\n
+ debit = max(qty, 0)\n
+ credit = max(-qty, 0)\n
\n
obj = Object(\n
parent_portal_type=transaction.getTranslatedPortalType(),\n
- parent_int_index="%05d" % transaction.getIntIndex(0),\n
+ parent_int_index=transaction.getIntIndex() and\n
+ ("%05d" % transaction.getIntIndex()) or \'\',\n
payment_mode_codification=payment_mode_codification,\n
parent_aggregate_title=sheet,\n
parent_origin_id=origin,\n
@@ -125,25 +140,26 @@
section_uid=brain.section_uid,\n
node_relative_url=brain.node_relative_url,\n
getObject=brain.getObject,\n
-# asContext=movement.asContext,\n
-# asContext=lambda *args, **kw: movement, # optim ?\n
-# Movement_getExplanationUrl=movement.Movement_getExplanationUrl,\n
\n
date=brain.date,\n
- debit=max(brain.total_price, 0),\n
- credit=max(-(brain.total_price or 0), 0), )\n
+ debit=debit,\n
+ credit=credit )\n
line_list.append(obj)\n
\n
if brain.node_relative_url:\n
# per account and origin\n
account = per_account_and_origin_cache.setdefault(\n
brain.node_relative_url, {})\n
- total = account.setdefault(origin, 0)\n
- account[origin] = total + (brain.total_price or 0)\n
+ total_debit, total_credit = account.get(origin, (0, 0))\n
+ account[origin] = ( total_debit + debit, total_credit + credit )\n
+ \n
# per origin and sheet\n
origin_cache = per_origin_and_sheet_cache.setdefault(origin, {})\n
- total = origin_cache.setdefault((sheet, brain.node_relative_url), 0)\n
- origin_cache[(sheet, brain.node_relative_url)] = total + (brain.total_price or 0)\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
\n
return line_list\n
</string> </value>
@@ -197,15 +213,18 @@
<string>cache_storage</string>
<string>selection_name</string>
<string>accounting_movement_type_list</string>
+ <string>precision</string>
+ <string>portal</string>
<string>stool</string>
<string>selection</string>
<string>per_account_and_origin_cache</string>
<string>per_origin_and_sheet_cache</string>
- <string>simtool</string>
<string>_write_</string>
<string>None</string>
<string>payment_mode_cache</string>
<string>getPaymentModeCodification</string>
+ <string>origin_id_cache</string>
+ <string>getOriginId</string>
<string>_getiter_</string>
<string>brain</string>
<string>movement</string>
@@ -213,10 +232,15 @@
<string>origin</string>
<string>sheet</string>
<string>payment_mode_codification</string>
+ <string>round</string>
+ <string>qty</string>
<string>max</string>
+ <string>debit</string>
+ <string>credit</string>
<string>obj</string>
<string>account</string>
- <string>total</string>
+ <string>total_debit</string>
+ <string>total_credit</string>
<string>origin_cache</string>
</tuple>
</value>
Modified: erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_getPerAccountAndOriginSummaryLineList.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_getPerAccountAndOriginSummaryLineList.xml?rev=13168&r1=13167&r2=13168&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_getPerAccountAndOriginSummaryLineList.xml (original)
+++ erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_getPerAccountAndOriginSummaryLineList.xml Thu Mar 1 23:40:25 2007
@@ -69,7 +69,7 @@
<item>
<key> <string>_body</string> </key>
<value> <string>from Products.PythonScripts.standard import Object\n
-cache_storage = context.REQUEST.other\n
+cache_storage = container.REQUEST.other\n
line_list = []\n
portal = context.getPortalObject()\n
total_debit = 0\n
@@ -82,10 +82,9 @@
for account_url in account_list:\n
values = account_cache[account_url]\n
account_title = portal.restrictedTraverse(account_url).Account_getFormattedTitle()\n
- for origin, total_price in values.items():\n
- debit = max(total_price, 0)\n
+ \n
+ for origin, (debit, credit) in values.items():\n
total_debit += debit\n
- credit = -min(total_price, 0)\n
total_credit += credit\n
line_list.append(Object(uid=\'new_\',\n
origin=origin,\n
@@ -142,9 +141,10 @@
<string>Products.PythonScripts.standard</string>
<string>Object</string>
<string>_getattr_</string>
- <string>context</string>
+ <string>container</string>
<string>cache_storage</string>
<string>line_list</string>
+ <string>context</string>
<string>portal</string>
<string>total_debit</string>
<string>total_credit</string>
@@ -156,10 +156,7 @@
<string>values</string>
<string>account_title</string>
<string>origin</string>
- <string>total_price</string>
- <string>max</string>
<string>debit</string>
- <string>min</string>
<string>credit</string>
<string>_write_</string>
</tuple>
Modified: erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_getPerAccountClassSummaryList.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_getPerAccountClassSummaryList.xml?rev=13168&r1=13167&r2=13168&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_getPerAccountClassSummaryList.xml (original)
+++ erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_getPerAccountClassSummaryList.xml Thu Mar 1 23:40:25 2007
@@ -81,10 +81,8 @@
account_list.sort()\n
\n
for account_url in account_list:\n
- total_price = account_cache[account_url]\n
- debit = round(max(total_price, 0), 2)\n
+ debit, credit = account_cache[account_url]\n
total_debit += debit\n
- credit = round(-min(total_price, 0), 2)\n
total_credit += credit\n
\n
line_list.append(Object(uid=\'new_\',\n
@@ -158,11 +156,7 @@
<string>account_list</string>
<string>_getiter_</string>
<string>account_url</string>
- <string>total_price</string>
- <string>round</string>
- <string>max</string>
<string>debit</string>
- <string>min</string>
<string>credit</string>
<string>_write_</string>
</tuple>
Modified: erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_getPerOriginAndSheetSummaryLineList.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_getPerOriginAndSheetSummaryLineList.xml?rev=13168&r1=13167&r2=13168&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_getPerOriginAndSheetSummaryLineList.xml (original)
+++ erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_getPerOriginAndSheetSummaryLineList.xml Thu Mar 1 23:40:25 2007
@@ -69,7 +69,7 @@
<item>
<key> <string>_body</string> </key>
<value> <string>from Products.PythonScripts.standard import Object\n
-cache_storage = context.REQUEST.other\n
+cache_storage = container.REQUEST.other\n
line_list = []\n
portal = context.getPortalObject()\n
total_debit = 0\n
@@ -83,13 +83,9 @@
values = origin_cache[origin]\n
items = values.items()\n
items.sort()\n
- for (sheet, account_url), total_price in items:\n
+ for (sheet, account_url), (debit, credit) in items:\n
account = portal.restrictedTraverse(account_url)\n
-\n
- # XXX assume a precision of 2 places, because we use EUR for M9\n
- debit = round(max(total_price, 0), 2)\n
total_debit += debit\n
- credit = round(-min(total_price, 0), 2)\n
total_credit += credit\n
line_list.append(Object(uid=\'new_\',\n
origin=origin,\n
@@ -149,9 +145,10 @@
<string>Products.PythonScripts.standard</string>
<string>Object</string>
<string>_getattr_</string>
- <string>context</string>
+ <string>container</string>
<string>cache_storage</string>
<string>line_list</string>
+ <string>context</string>
<string>portal</string>
<string>total_debit</string>
<string>total_credit</string>
@@ -164,13 +161,9 @@
<string>items</string>
<string>sheet</string>
<string>account_url</string>
- <string>total_price</string>
+ <string>debit</string>
+ <string>credit</string>
<string>account</string>
- <string>round</string>
- <string>max</string>
- <string>debit</string>
- <string>min</string>
- <string>credit</string>
<string>_write_</string>
</tuple>
</value>
Modified: erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/bt/revision?rev=13168&r1=13167&r2=13168&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/bt/revision (original)
+++ erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/bt/revision Thu Mar 1 23:40:25 2007
@@ -1,1 +1,1 @@
-79
+82
More information about the Erp5-report
mailing list