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

Calculate GL summary correctly and pass precision parameter

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@14193 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7c758071
...@@ -90,12 +90,18 @@ period_start_date = context\\\n ...@@ -90,12 +90,18 @@ period_start_date = context\\\n
.Base_getAccountingPeriodStartDateForSectionCategory(\n .Base_getAccountingPeriodStartDateForSectionCategory(\n
section_category=section_category, date=from_date or at_date)\n section_category=section_category, date=from_date or at_date)\n
\n \n
# currency precision\n
currency = portal.Base_getCurrencyForSection(request[\'section_category\'])\n
precision = portal.account_module.getQuantityPrecisionFromResource(currency)\n
request.set(\'precision\', precision)\n
\n
# TODO\n # TODO\n
omit_grouping_reference = request.get(\'omit_grouping_reference\', False)\n omit_grouping_reference = request.get(\'omit_grouping_reference\', False)\n
\n \n
request.other[\'is_accounting_report\'] = True\n request.other[\'is_accounting_report\'] = True\n
\n \n
params = dict(at_date=at_date,\n params = dict(at_date=at_date,\n
precision=precision,\n
section_uid=section_uid,\n section_uid=section_uid,\n
simulation_state=simulation_state,\n simulation_state=simulation_state,\n
omit_grouping_reference=omit_grouping_reference,\n omit_grouping_reference=omit_grouping_reference,\n
...@@ -313,6 +319,8 @@ return result\n ...@@ -313,6 +319,8 @@ return result\n
<string>False</string> <string>False</string>
<string>display_categories</string> <string>display_categories</string>
<string>period_start_date</string> <string>period_start_date</string>
<string>currency</string>
<string>precision</string>
<string>omit_grouping_reference</string> <string>omit_grouping_reference</string>
<string>_write_</string> <string>_write_</string>
<string>dict</string> <string>dict</string>
......
...@@ -76,14 +76,48 @@ inventory_kw = dict(section_uid=section_uid,\n ...@@ -76,14 +76,48 @@ inventory_kw = dict(section_uid=section_uid,\n
at_date=at_date,\n at_date=at_date,\n
portal_type=context.getPortalAccountingMovementTypeList(),\n portal_type=context.getPortalAccountingMovementTypeList(),\n
)\n )\n
if node_category:\n
inventory_kw[\'node_category\'] = node_category\n
\n \n
return [Object(\n if node_category:\n
# XXX if node category is passed, income or balance accounts are not\n
# calculated differently. As a result, the summary doesn\'t take from_date\n
# into account for income accounts.\n
return [Object(\n
debit=getInventoryAssetPrice(omit_output=1,\n debit=getInventoryAssetPrice(omit_output=1,\n
node_category=node_category,\n
precision=precision,\n
**inventory_kw),\n **inventory_kw),\n
credit= - getInventoryAssetPrice(omit_input=1,\n credit=-getInventoryAssetPrice(omit_input=1,\n
**inventory_kw) or 0,)]\n node_category=node_category,\n
precision=precision,\n
**inventory_kw) or 0 ) ]\n
\n
income_node_category = [\'account_type/income\', \'account_type/expense\']\n
balance_node_category = [\'account_type/equity\', \'account_type/asset\',\n
\'account_type/liability\']\n
\n
debit = getInventoryAssetPrice(omit_output=1,\n
from_date=period_start_date,\n
node_category=income_node_category,\n
precision=precision,\n
**inventory_kw)\n
\n
credit = - getInventoryAssetPrice(omit_input=1,\n
from_date=period_start_date,\n
node_category=income_node_category,\n
precision=precision,\n
**inventory_kw) or 0\n
\n
debit += getInventoryAssetPrice(omit_output=1,\n
node_category=balance_node_category,\n
precision=precision,\n
**inventory_kw)\n
\n
credit -= getInventoryAssetPrice(omit_input=1,\n
node_category=balance_node_category,\n
precision=precision,\n
**inventory_kw) or 0\n
\n
return [Object(debit=debit, credit=credit)]\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
...@@ -106,7 +140,7 @@ return [Object(\n ...@@ -106,7 +140,7 @@ return [Object(\n
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>section_uid, simulation_state, at_date, node_category=None, from_date=\'ignored\', **kw</string> </value> <value> <string>section_uid, simulation_state, at_date, period_start_date, precision, node_category=None, from_date=\'ignored\', **kw</string> </value>
</item> </item>
<item> <item>
<key> <string>errors</string> </key> <key> <string>errors</string> </key>
...@@ -126,7 +160,7 @@ return [Object(\n ...@@ -126,7 +160,7 @@ return [Object(\n
<dictionary> <dictionary>
<item> <item>
<key> <string>co_argcount</string> </key> <key> <string>co_argcount</string> </key>
<value> <int>5</int> </value> <value> <int>7</int> </value>
</item> </item>
<item> <item>
<key> <string>co_varnames</string> </key> <key> <string>co_varnames</string> </key>
...@@ -135,18 +169,23 @@ return [Object(\n ...@@ -135,18 +169,23 @@ return [Object(\n
<string>section_uid</string> <string>section_uid</string>
<string>simulation_state</string> <string>simulation_state</string>
<string>at_date</string> <string>at_date</string>
<string>period_start_date</string>
<string>precision</string>
<string>node_category</string> <string>node_category</string>
<string>from_date</string> <string>from_date</string>
<string>kw</string> <string>kw</string>
<string>Products.PythonScripts.standard</string> <string>Products.PythonScripts.standard</string>
<string>Object</string> <string>Object</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>getInventoryAssetPrice</string> <string>getInventoryAssetPrice</string>
<string>dict</string> <string>dict</string>
<string>inventory_kw</string> <string>inventory_kw</string>
<string>_write_</string>
<string>_apply_</string> <string>_apply_</string>
<string>income_node_category</string>
<string>balance_node_category</string>
<string>debit</string>
<string>credit</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
278 279
\ 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