[Erp5-report] r40368 jerome - in /erp5/trunk/bt5/erp5_accounting: SkinTemplateItem/portal_s...
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Nov 18 14:14:36 CET 2010
Author: jerome
Date: Thu Nov 18 14:14:36 2010
New Revision: 40368
URL: http://svn.erp5.org?rev=40368&view=rev
Log:
fix account statement for income & expense accounts with a from date before the current accounting period
Modified:
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/Node_getAccountingTransactionList.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Node_getAccountingTransactionList.xml?rev=40368&r1=40367&r2=40368&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Node_getAccountingTransactionList.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Node_getAccountingTransactionList.xml [utf8] Thu Nov 18 14:14:36 2010
@@ -63,10 +63,6 @@ if params.get(\'precision\', None) is no
# listbox editable float fields uses request/precision to format the value.\n
request.set(\'precision\', params[\'precision\'])\n
\n
-if not from_date:\n
- from_date = portal.portal_preferences\\\n
- .getPreferredAccountingTransactionFromDate()\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
@@ -134,11 +130,16 @@ if params.get(\'node_uid\'):\n
is_pl_account = node.isMemberOf(\'account_type/expense\')\\\n
or node.isMemberOf(\'account_type/income\')\n
\n
+if is_pl_account and not from_date:\n
+ from_date = params.get(\'period_start_date\')\n
+\n
if from_date or is_pl_account:\n
period_start_date = None\n
# Create a new parameter list to get the previous balance\n
get_inventory_kw = params.copy()\n
\n
+ initial_balance_from_date = from_date\n
+\n
# ignore any at_date that could lay in params\n
get_inventory_kw.pop(\'at_date\', None)\n
\n
@@ -147,20 +148,21 @@ if from_date or is_pl_account:\n
# if we have on an expense / income account, only take into account\n
# movements from the current period.\n
period_start_date = params[\'period_start_date\']\n
- if from_date:\n
- from_date = max(period_start_date, from_date)\n
+ if initial_balance_from_date:\n
+ initial_balance_from_date = max(period_start_date,\n
+ initial_balance_from_date)\n
else:\n
- from_date = period_start_date\n
+ initial_balance_from_date = period_start_date\n
else:\n
# for all other accounts, we calculate initial balance\n
period_start_date = params[\'period_start_date\']\n
- if not from_date:\n
+ if not initial_balance_from_date:\n
# I don\'t think this should happen\n
log(\'from_date not passed, defaulting to period_start_date\')\n
- from_date = period_start_date\n
+ initial_balance_from_date = period_start_date\n
\n
# Get previous debit and credit\n
- if from_date == period_start_date and is_pl_account:\n
+ if initial_balance_from_date == period_start_date and is_pl_account:\n
previous_total_debit = previous_total_credit = 0\n
else:\n
getInventoryAssetPrice = portal.portal_simulation.getInventoryAssetPrice\n
@@ -170,17 +172,17 @@ if from_date or is_pl_account:\n
else:\n
period_openning_balance = getInventoryAssetPrice(\n
to_date=min(period_start_date,\n
- from_date),\n
+ initial_balance_from_date),\n
**get_inventory_kw)\n
\n
# then all movement between period_start_date and from_date\n
previous_total_debit = getInventoryAssetPrice(omit_asset_decrease=True,\n
from_date=period_start_date,\n
- to_date=from_date,\n
+ to_date=initial_balance_from_date,\n
**get_inventory_kw) + max(period_openning_balance, 0)\n
previous_total_credit = getInventoryAssetPrice(omit_asset_increase=True,\n
from_date=period_start_date,\n
- to_date=from_date,\n
+ to_date=initial_balance_from_date,\n
**get_inventory_kw) - max(-period_openning_balance, 0)\n
\n
if previous_total_credit != 0:\n
@@ -197,7 +199,7 @@ if from_date or is_pl_account:\n
previous_balance = newTempBase(portal, \'_temp_accounting_transaction\')\n
previous_balance.edit(\n
uid=\'new_000\',\n
- date=from_date,\n
+ date=initial_balance_from_date,\n
simulation_state_title="",\n
credit_price=previous_total_credit,\n
debit_price=previous_total_debit,\n
@@ -323,6 +325,7 @@ return portal.portal_simulation.getMovem
<string>node</string>
<string>period_start_date</string>
<string>get_inventory_kw</string>
+ <string>initial_balance_from_date</string>
<string>max</string>
<string>previous_total_debit</string>
<string>previous_total_credit</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=40368&r1=40367&r2=40368&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Node_statAccountingBalance.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/Node_statAccountingBalance.xml [utf8] Thu Nov 18 14:14:36 2010
@@ -125,8 +125,11 @@ if params.get(\'period_start_date\', 0)
if node.isMemberOf(\'account_type/expense\') or\\\n
node.isMemberOf(\'account_type/income\'):\n
# For expense or income accounts, we only take into account transactions\n
- # from the beginning of the period.\n
- params[\'from_date\'] = params[\'period_start_date\']\n
+ # from the beginning of the period, unless a from_date prior to this\n
+ # beginning is passed explicitly.\n
+ # if we are in the regular user interface, we only limit\n
+ if \'from_date\' in kw:\n
+ params[\'from_date\'] = min(kw[\'from_date\'], params[\'period_start_date\'])\n
else:\n
# for other account, we calculate the initial balance as the "absolute"\n
# balance at the beginning of the period, plus debit or credit from this\n
@@ -224,6 +227,7 @@ return getInventoryAssetPrice(\n
<string>function_uid</string>
<string>function_category</string>
<string>node</string>
+ <string>min</string>
<string>period_start_date</string>
<string>at_date</string>
<string>_apply_</string>
Modified: erp5/trunk/bt5/erp5_accounting/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/bt/revision?rev=40368&r1=40367&r2=40368&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/bt/revision [utf8] (original)
+++ erp5/trunk/bt5/erp5_accounting/bt/revision [utf8] Thu Nov 18 14:14:36 2010
@@ -1 +1 @@
-1391
\ No newline at end of file
+1404
\ No newline at end of file
More information about the Erp5-report
mailing list