[Erp5-report] r14193 - in /erp5/trunk/bt5/erp5_accounting: SkinTemplateItem/portal_skins/er...

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Apr 24 18:55:10 CEST 2007


Author: jerome
Date: Tue Apr 24 18:55:08 2007
New Revision: 14193

URL: http://svn.erp5.org?rev=14193&view=rev
Log:
Calculate GL summary correctly and pass precision parameter

Modified:
    erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getGeneralLedgerReportSectionList.xml
    erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getGeneralLedgerSummary.xml
    erp5/trunk/bt5/erp5_accounting/bt/revision

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=14193&r1=14192&r2=14193&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 Tue Apr 24 18:55:08 2007
@@ -90,12 +90,18 @@
     .Base_getAccountingPeriodStartDateForSectionCategory(\n
           section_category=section_category, date=from_date or at_date)\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
 omit_grouping_reference = request.get(\'omit_grouping_reference\', False)\n
 \n
 request.other[\'is_accounting_report\'] = True\n
 \n
 params = dict(at_date=at_date,\n
+              precision=precision,\n
               section_uid=section_uid,\n
               simulation_state=simulation_state,\n
               omit_grouping_reference=omit_grouping_reference,\n
@@ -313,6 +319,8 @@
                             <string>False</string>
                             <string>display_categories</string>
                             <string>period_start_date</string>
+                            <string>currency</string>
+                            <string>precision</string>
                             <string>omit_grouping_reference</string>
                             <string>_write_</string>
                             <string>dict</string>

Modified: erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getGeneralLedgerSummary.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getGeneralLedgerSummary.xml?rev=14193&r1=14192&r2=14193&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getGeneralLedgerSummary.xml (original)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getGeneralLedgerSummary.xml Tue Apr 24 18:55:08 2007
@@ -76,14 +76,48 @@
                     at_date=at_date,\n
                     portal_type=context.getPortalAccountingMovementTypeList(),\n
                     )\n
+\n
 if node_category:\n
-  inventory_kw[\'node_category\'] = node_category\n
-\n
-return [Object(\n
-   debit=getInventoryAssetPrice(omit_output=1,\n
-                                **inventory_kw),\n
-  credit= - getInventoryAssetPrice(omit_input=1,\n
-                                **inventory_kw) or 0,)]\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
+                               node_category=node_category,\n
+                               precision=precision,\n
+                               **inventory_kw),\n
+            credit=-getInventoryAssetPrice(omit_input=1,\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>
         </item>
         <item>
@@ -106,7 +140,7 @@
         </item>
         <item>
             <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>
             <key> <string>errors</string> </key>
@@ -126,7 +160,7 @@
                   <dictionary>
                     <item>
                         <key> <string>co_argcount</string> </key>
-                        <value> <int>5</int> </value>
+                        <value> <int>7</int> </value>
                     </item>
                     <item>
                         <key> <string>co_varnames</string> </key>
@@ -135,18 +169,23 @@
                             <string>section_uid</string>
                             <string>simulation_state</string>
                             <string>at_date</string>
+                            <string>period_start_date</string>
+                            <string>precision</string>
                             <string>node_category</string>
                             <string>from_date</string>
                             <string>kw</string>
                             <string>Products.PythonScripts.standard</string>
                             <string>Object</string>
                             <string>_getattr_</string>
-<string>context</string>
+                            <string>context</string>
                             <string>getInventoryAssetPrice</string>
                             <string>dict</string>
                             <string>inventory_kw</string>
-                            <string>_write_</string>
                             <string>_apply_</string>
+                            <string>income_node_category</string>
+                            <string>balance_node_category</string>
+                            <string>debit</string>
+                            <string>credit</string>
                           </tuple>
                         </value>
                     </item>

Modified: erp5/trunk/bt5/erp5_accounting/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/bt/revision?rev=14193&r1=14192&r2=14193&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/bt/revision (original)
+++ erp5/trunk/bt5/erp5_accounting/bt/revision Tue Apr 24 18:55:08 2007
@@ -1,1 +1,1 @@
-278
+279




More information about the Erp5-report mailing list