[Erp5-report] r14052 - in /erp5/trunk/bt5/erp5_accounting: SkinTemplateItem/portal_skins/er...
nobody at svn.erp5.org
nobody at svn.erp5.org
Wed Apr 11 18:21:14 CEST 2007
Author: jerome
Date: Wed Apr 11 18:21:12 2007
New Revision: 14052
URL: http://svn.erp5.org?rev=14052&view=rev
Log:
for expense or income accounts, only consider movements from the current
period. Apply this for UI, Account Statements and GL reports.
Also fix a problem with URL method for initial balance line.
Modified:
erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getAccountStatementReportSectionList.xml
erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getGeneralLedgerReportSectionList.xml
erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/ERP5Accounting_getParams.xml
erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Node_getAccountingTransactionList.xml
erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Node_statAccountingBalance.xml
erp5/trunk/bt5/erp5_accounting/bt/revision
Modified: erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getAccountStatementReportSectionList.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getAccountStatementReportSectionList.xml?rev=14052&r1=14051&r2=14052&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getAccountStatementReportSectionList.xml (original)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getAccountStatementReportSectionList.xml Wed Apr 11 18:21:12 2007
@@ -82,7 +82,6 @@
# for preference info fields on Account_viewAccountingTransactionList\n
request.set(\'is_accounting_report\', True)\n
\n
-\n
at_date = request[\'at_date\']\n
section_uid = context.Base_getSectionUidListForSectionCategory(\n
request[\'section_category\'])\n
@@ -95,6 +94,10 @@
from_date = request.get(\'from_date\', None)\n
omit_grouping_reference = request.get(\'omit_grouping_reference\', 0)\n
parent_portal_type = request.get(\'portal_type\')\n
+period_start_date = context\\\n
+ .Base_getAccountingPeriodStartDateForSectionCategory(\n
+ section_category=request[\'section_category\'],\n
+ date=from_date or at_date)\n
\n
# Also get the currency, to know the precision\n
currency = context.Base_getCurrencyForSection(request[\'section_category\'])\n
@@ -103,9 +106,9 @@
request.set(\'precision\', precision)\n
\n
params = dict(at_date=at_date,\n
+ period_start_date=period_start_date,\n
section_uid=section_uid,\n
node_uid=traverse(node).getUid(),\n
- from_date_summary=1,\n
simulation_state=simulation_state, )\n
if from_date:\n
params[\'from_date\'] = from_date\n
@@ -199,6 +202,7 @@
<string>from_date</string>
<string>omit_grouping_reference</string>
<string>parent_portal_type</string>
+ <string>period_start_date</string>
<string>currency</string>
<string>precision</string>
<string>dict</string>
Modified: erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getGeneralLedgerReportSectionList.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getGeneralLedgerReportSectionList.xml?rev=14052&r1=14051&r2=14052&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getGeneralLedgerReportSectionList.xml (original)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getGeneralLedgerReportSectionList.xml Wed Apr 11 18:21:12 2007
@@ -80,12 +80,16 @@
at_date = request[\'at_date\']\n
section_category = request[\'section_category\']\n
section_uid = context.Base_getSectionUidListForSectionCategory(\n
- request[\'section_category\'])\n
+ section_category)\n
simulation_state = request[\'simulation_state\']\n
from_date = request.get(\'from_date\', None)\n
gap = request.get(\'gap\', None)\n
omit_empty_accounts = request.get(\'omit_empty_accounts\', True)\n
display_categories = request.get(\'display_categories\', False)\n
+period_start_date = context\\\n
+ .Base_getAccountingPeriodStartDateForSectionCategory(\n
+ section_category=section_category, date=from_date or at_date)\n
+\n
# TODO\n
omit_grouping_reference = request.get(\'omit_grouping_reference\', False)\n
\n
@@ -95,16 +99,13 @@
section_uid=section_uid,\n
simulation_state=simulation_state,\n
omit_grouping_reference=omit_grouping_reference,\n
- from_date_summary=True,\n
+ period_start_date=period_start_date,\n
no_mirror_section_uid_cache=1)\n
\n
if from_date:\n
params[\'from_date\'] = from_date\n
-else:\n
- params[\'no_from_date\'] = True\n
\n
result = []\n
-\n
\n
account_columns = (\n
(\'Movement_getSpecificReference\', \'Reference\'),\n
@@ -310,6 +311,7 @@
<string>omit_empty_accounts</string>
<string>False</string>
<string>display_categories</string>
+ <string>period_start_date</string>
<string>omit_grouping_reference</string>
<string>_write_</string>
<string>dict</string>
Modified: erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/ERP5Accounting_getParams.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/ERP5Accounting_getParams.xml?rev=14052&r1=14051&r2=14052&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/ERP5Accounting_getParams.xml (original)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/ERP5Accounting_getParams.xml Wed Apr 11 18:21:12 2007
@@ -100,6 +100,7 @@
selection_params = selection.getParams()\n
preference = context.getPortalObject().portal_preferences\n
\n
+from_date = None\n
if wants_from_date:\n
from_date = selection_params.get(\'from_date\',\n
preference.getPreferredAccountingTransactionFromDate())\n
@@ -120,6 +121,14 @@
# an instance of Base, so we call it on account_module.\n
params[\'precision\'] = context.account_module\\\n
.getQuantityPrecisionFromResource(currency)\n
+\n
+ # calculate the period_start_date for this section\n
+ # note that reports that precalculate a section_uid but no section_category\n
+ # will have to calculate period_start_date themselves.\n
+ if from_date or at_date:\n
+ params[\'period_start_date\'] = \\\n
+ context.Base_getAccountingPeriodStartDateForSectionCategory(\n
+ section_category=section_category, date=from_date or at_date)\n
\n
# if we have a section uid, it haves priority\n
section_uid = selection_params.get(\'section_uid\', None)\n
Modified: erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Node_getAccountingTransactionList.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Node_getAccountingTransactionList.xml?rev=14052&r1=14051&r2=14052&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Node_getAccountingTransactionList.xml (original)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Node_getAccountingTransactionList.xml Wed Apr 11 18:21:12 2007
@@ -83,11 +83,6 @@
from_date = portal.portal_preferences\\\n
.getPreferredAccountingTransactionFromDate()\n
\n
-# XXX needed ?\n
-if kw.get(\'no_from_date\') and from_date:\n
- from_date = None\n
-\n
-\n
# this script can be used for Node, Section or Payment\n
if kw.get(\'node_uid\'):\n
params[\'node_uid\'] = kw[\'node_uid\']\n
@@ -104,21 +99,44 @@
new_result = []\n
net_balance = 0.0\n
\n
-if from_date:\n
+node_account_type = None\n
+if params.get(\'node_uid\'):\n
+ if context.getUid() == params[\'node_uid\']:\n
+ node_account_type = context.getAccountTypeId()\n
+ else:\n
+ node = portal.portal_catalog.getObject(params[\'node_uid\'])\n
+ node_account_type = node.getAccountTypeId()\n
+\n
+if from_date or node_account_type in (\'expense\', \'income\'):\n
+ period_start_date = None\n
# Create a new parameter list to get the previous balance\n
- get_inventory_kw = params.copy() # do not include omit_grouping here\n
+ get_inventory_kw = params.copy()\n
get_inventory_kw[\'to_date\'] = from_date\n
- # TODO: using a list of section_uid \n
- # \'where_expression\': " section.portal_type = \'Organisation\' " \n
+\n
+ # ignore any at_date that could lay in params\n
get_inventory_kw.pop(\'at_date\', None)\n
\n
+ # if we have on an expense / income account, only take into account movements\n
+ # from the current period.\n
+ if params.has_key(\'period_start_date\') and \\\n
+ node_account_type in (\'expense\', \'income\'):\n
+ period_start_date = params[\'period_start_date\']\n
+ get_inventory_kw[\'from_date\'] = period_start_date\n
+ if from_date:\n
+ from_date = max(period_start_date, from_date)\n
+ else:\n
+ from_date = period_start_date\n
+\n
# Get previous debit and credit\n
- getInventoryAssetPrice = portal.portal_simulation.getInventoryAssetPrice\n
- # XXX missing Inventory API Feature: this could be retrived in 1 SQL Query\n
- previous_total_debit = getInventoryAssetPrice(omit_output=True,\n
+ if from_date == period_start_date:\n
+ previous_total_debit = previous_total_credit = 0\n
+ else:\n
+ getInventoryAssetPrice = portal.portal_simulation.getInventoryAssetPrice\n
+ # XXX missing Inventory API Feature ? this could be retrived in 1 SQL Query\n
+ previous_total_debit = getInventoryAssetPrice(omit_output=True,\n
**get_inventory_kw)\n
- previous_total_credit = getInventoryAssetPrice(omit_input =True,\n
- **get_inventory_kw)\n
+ previous_total_credit = getInventoryAssetPrice(omit_input =True,\n
+ **get_inventory_kw)\n
if previous_total_credit != 0:\n
previous_total_credit = - previous_total_credit\n
\n
@@ -144,6 +162,7 @@
Movement_getExplanationReference=\'\',\n
Movement_getMirrorSectionTitle=\'\',\n
Movement_getNodeGapId=\'\',\n
+ Movement_getExplanationUrl=lambda **kw: \'\',\n
Node_statAccountingBalance=\'\',\n
getTranslatedSimulationStateTitle=\'\',\n
)\n
@@ -239,12 +258,16 @@
<string>_write_</string>
<string>new_result</string>
<string>net_balance</string>
+ <string>node_account_type</string>
+ <string>node</string>
+ <string>period_start_date</string>
<string>get_inventory_kw</string>
+ <string>max</string>
+ <string>previous_total_debit</string>
+ <string>previous_total_credit</string>
<string>getInventoryAssetPrice</string>
<string>_apply_</string>
<string>True</string>
- <string>previous_total_debit</string>
- <string>previous_total_credit</string>
<string>Products.ERP5Type.Document</string>
<string>newTempAccountingTransaction</string>
<string>previous_balance</string>
Modified: erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Node_statAccountingBalance.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Node_statAccountingBalance.xml?rev=14052&r1=14051&r2=14052&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Node_statAccountingBalance.xml (original)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Node_statAccountingBalance.xml Wed Apr 11 18:21:12 2007
@@ -73,6 +73,7 @@
\n
if kw.get(\'node_uid\'):\n
params[\'node_uid\'] = kw[\'node_uid\']\n
+\n
if kw.get(\'mirror_section_uid\'):\n
params[\'mirror_section_uid\'] = kw[\'mirror_section_uid\']\n
\n
@@ -91,10 +92,16 @@
if kw.get(\'where_expression\'):\n
params[\'where_expression\'] = kw[\'where_expression\']\n
\n
-# Don\'t use the from_date parameter if from_date_summary is present\n
-# XXX actually I never use from date here -jerome\n
-if kw.get(\'from_date_summary\', 0) and params.has_key(\'from_date\'):\n
- del params[\'from_date\']\n
+# For expense or income accounts, we only take into account transactions from the\n
+# beginning of the period.\n
+if params.get(\'period_start_date\', 0) and params.get(\'node_uid\'):\n
+ # find the node for this node_uid\n
+ if context.getUid() == params[\'node_uid\']: # I bet it\'s context\n
+ node = context\n
+ else:\n
+ node = portal.portal_catalog.getObject(params[\'node_uid\'])\n
+ if node.getAccountTypeId() in (\'expense\', \'income\'):\n
+ params[\'from_date\'] = params[\'period_start_date\']\n
\n
return portal.portal_simulation.getInventoryAssetPrice(\n
omit_input=omit_input,\n
@@ -162,6 +169,7 @@
<string>params</string>
<string>_getitem_</string>
<string>_write_</string>
+ <string>node</string>
<string>_apply_</string>
</tuple>
</value>
Modified: erp5/trunk/bt5/erp5_accounting/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/bt/revision?rev=14052&r1=14051&r2=14052&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/bt/revision (original)
+++ erp5/trunk/bt5/erp5_accounting/bt/revision Wed Apr 11 18:21:12 2007
@@ -1,1 +1,1 @@
-244
+250
More information about the Erp5-report
mailing list