[Erp5-report] r6703 - /erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_ac...

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Apr 14 23:13:52 CEST 2006


Author: kevin
Date: Fri Apr 14 23:13:51 2006
New Revision: 6703

URL: http://svn.erp5.org?rev=6703&view=rev
Log:
Remove previous hack by a less intrusive one.
Code clean-up.

Modified:
    erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getTrialBalanceSummary.xml

Modified: erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getTrialBalanceSummary.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getTrialBalanceSummary.xml?rev=6703&r1=6702&r2=6703&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getTrialBalanceSummary.xml (original)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getTrialBalanceSummary.xml Fri Apr 14 23:13:51 2006
@@ -70,45 +70,50 @@
 
 from DateTime import DateTime\n
 from Products.ERP5Type.Document import newTempBase\n
+\n
 selection_params = selection.getParams()\n
-get_inventory_kw = {}\n
-get_inventory_kw[\'section_category\'] = selection_params.get(\'section_category\')\n
-get_inventory_kw[\'simulation_state\'] = selection_params.get(\'transaction_simulation_state\')\n
-get_inventory_kw[\'node_category\'] = selection_params.get(\'gap_root\')\n
-get_inventory_kw[\'omit_simulation\'] = 1\n
-get_inventory_kw[\'section_portal_type_list\'] = [\'Organisation\']\n
-\n
-no_start_date = DateTime(1970, 1, 1)\n
+get_inventory_kw = {\n
+    \'section_category\': selection_params.get(\'section_category\')\n
+  , \'simulation_state\': selection_params.get(\'simulation_state\')\n
+  , \'node_category\'   : selection_params.get(\'gap_root\')\n
+  , \'omit_simulation\' : True\n
+  , \'where_expression\': " section.portal_type = \'Organisation\' "\n
+}\n
+\n
+at_date   = selection_params.get(\'at_date\', None)\n
+from_date = selection_params.get(\'from_date\', None)\n
 \n
 portal = context.getPortalObject()\n
 getInventory = portal.portal_simulation.getInventoryAssetPrice\n
 \n
+# FIXME: Here we do not want to sum all movement < 0, but sum the balances\n
+#        of all nodes whose which have a < 0 balance...\n
+opening_debit_balance = getInventory( at_date     = from_date\n
+                                    , omit_output = True\n
+                                    , **get_inventory_kw\n
+                                    )\n
+closing_debit_balance = getInventory( at_date     = at_date\n
+                                    , omit_output = True\n
+                                    , **get_inventory_kw\n
+                                    )\n
+opening_credit_balance = - getInventory( at_date    = from_date\n
+                                       , omit_input = True\n
+                                       , **get_inventory_kw\n
+                                       )\n
+closing_credit_balance = - getInventory( at_date    = at_date\n
+                                       , omit_input = True\n
+                                       , **get_inventory_kw\n
+                                       )\n
 \n
 list_item = newTempBase(portal, \'xxx\')\n
 list_item.setUid(\'new_000\')\n
 list_item.edit(** {\n
-    # FIXME: here we do not want to sum all movement < 0, but sum the balances\n
-    # of all nodes whose which have a < 0 balance...\n
-    \'total_opening_debit_balance\' : getInventory(\n
-                              at_date = selection_params.get(\'from_date\', no_start_date),\n
-                              omit_output = 1,\n
-                              **get_inventory_kw) or 0,\n
-\n
-    \'total_opening_credit_balance\' : - getInventory(\n
-                              at_date = selection_params.get(\'from_date\', no_start_date),\n
-                              omit_input = 1,\n
-                              **get_inventory_kw) or 0,\n
-\n
-    \'total_closing_debit_balance\' : getInventory(\n
-                              at_date = selection_params.get(\'at_date\'),\n
-                              omit_output = 1,\n
-                              **get_inventory_kw) or 0,\n
-\n
-    \'total_closing_credit_balance\' : - getInventory(\n
-                              at_date = selection_params.get(\'at_date\'),\n
-                              omit_input = 1,\n
-                              **get_inventory_kw) or 0,\n
-    })\n
+    \'total_opening_debit_balance\' : opening_debit_balance  or 0\n
+  , \'total_closing_debit_balance\' : closing_debit_balance  or 0\n
+  , \'total_opening_credit_balance\': opening_credit_balance or 0\n
+  , \'total_closing_credit_balance\': closing_credit_balance or 0\n
+  })\n
+\n
 return [list_item]\n
 
 
@@ -165,14 +170,20 @@
                             <string>newTempBase</string>
                             <string>_getattr_</string>
                             <string>selection_params</string>
+                            <string>True</string>
                             <string>get_inventory_kw</string>
-                            <string>_write_</string>
-                            <string>no_start_date</string>
+                            <string>None</string>
+                            <string>at_date</string>
+                            <string>from_date</string>
                             <string>context</string>
                             <string>portal</string>
                             <string>getInventory</string>
+                            <string>_apply_</string>
+                            <string>opening_debit_balance</string>
+                            <string>closing_debit_balance</string>
+                            <string>opening_credit_balance</string>
+                            <string>closing_credit_balance</string>
                             <string>list_item</string>
-                            <string>_apply_</string>
                           </tuple>
                         </value>
                     </item>




More information about the Erp5-report mailing list