[Erp5-report] r11452 - in /erp5/trunk/bt5/erp5_accounting_l10n_fr_m9: SkinTemplateItem/port...

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Nov 22 23:21:26 CET 2006


Author: jerome
Date: Wed Nov 22 23:21:21 2006
New Revision: 11452

URL: http://svn.erp5.org?rev=11452&view=rev
Log:
Optimisations on AccountingTransactionModule_getM9AccountingTransactionReport:
 * prefer calculating brain attributes than using TALES expression on editable fields
 * reuse accounting transactions module's selection SQL query as a subquery in getMovementHistoryList instead of getting all objects
 * use Object rather than asSource|DestinationBrain methods that will likely never exist


Removed:
    erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_viewM9AccountingTransactionListReportSection/listbox_parent_aggregate_title.xml
    erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_viewM9AccountingTransactionListReportSection/listbox_parent_int_index.xml
    erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_viewM9AccountingTransactionListReportSection/listbox_parent_origin_id.xml
    erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_viewM9AccountingTransactionListReportSection/listbox_parent_portal_type.xml
Modified:
    erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_getM9AccountingTransactionLineList.xml
    erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_viewM9AccountingTransactionListReportSection.xml
    erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_viewM9AccountingTransactionListReportSection/listbox.xml
    erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_viewM9AccountingTransactionListReportSection/listbox_credit.xml
    erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_viewM9AccountingTransactionListReportSection/listbox_date.xml
    erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_viewM9AccountingTransactionListReportSection/listbox_debit.xml
    erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/bt/revision

Modified: erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_getM9AccountingTransactionLineList.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_getM9AccountingTransactionLineList.xml?rev=11452&r1=11451&r2=11452&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_getM9AccountingTransactionLineList.xml (original)
+++ erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_getM9AccountingTransactionLineList.xml Wed Nov 22 23:21:21 2006
@@ -68,44 +68,65 @@
         </item>
         <item>
             <key> <string>_body</string> </key>
-            <value> <string>line_list = []\n
+            <value> <string>from Products.PythonScripts.standard import Object\n
+line_list = []\n
 cache_storage = context.REQUEST.other\n
 selection_name = \'accounting_selection\'\n
 accounting_movement_type_list = context.getPortalAccountingMovementTypeList()\n
 \n
 stool = context.getPortalObject().portal_selections\n
+selection = stool.getSelectionFor(selection_name)\n
 per_account_and_origin_cache = cache_storage.setdefault(\n
                           \'m9_report_per_account_and_origin_summary\', {})\n
 per_origin_and_sheet_cache = cache_storage.setdefault(\n
                           \'m9_report_per_origin_and_sheet_summary\', {})\n
 \n
-for transaction in stool.callSelectionFor(selection_name):\n
-  transaction = transaction.getObject()\n
-  is_source = transaction.AccountingTransaction_isSourceView()\n
-  origin = transaction.getOriginId()\n
-  try:\n
-    sheet = transaction.getAggregateTitle(\n
-                              portal_type=\'Invoice Transmission Sheet\')\n
-  except AttributeError:\n
-    sheet = \'\'\n
-  for line in transaction.getMovementList(\n
-                            portal_type=accounting_movement_type_list):\n
-    if is_source:\n
-      line = line.asSourceBrain()\n
-    else:\n
-      line = line.asDestinationBrain()\n
-    line_list.append(line)\n
-\n
-    if line.node_relative_url:\n
-      # per account and origin\n
-      account = per_account_and_origin_cache.setdefault(\n
-                                        line.node_relative_url, {})\n
-      total = account.setdefault(origin, 0)\n
-      account[origin] = total + (line.total_price or 0)\n
-      # per origin and sheet    \n
-      origin_cache = per_origin_and_sheet_cache.setdefault(origin, {})\n
-      total = origin_cache.setdefault((line.node_relative_url, sheet), 0)\n
-      origin_cache[(line.node_relative_url, sheet)] = total + (line.total_price or 0)\n
+simtool = context.portal_simulation\n
+# FIXME: how to pass pass parameter in the selection without\n
+# making them persistent ?\n
+context.REQUEST.other[\'src__\'] = 1\n
+context.REQUEST.other[\'no_limit\'] = 1\n
+context.REQUEST.other[\'search_result_keys\'] = [\'catalog.uid\']\n
+\n
+# call getMovementHistory by building a subquery with accounting module\n
+# selection\'s query, using the src__=1 trick from above\n
+for brain in simtool.getMovementHistoryList(\n
+        where_expression="catalog.parent_uid IN (%s)" %\n
+                                 stool.callSelectionFor(selection_name),\n
+        section_category=selection.getParams().get(\'section_category\')):\n
+\n
+  movement = brain.getObject()\n
+  transaction = movement.getParentValue()\n
+  origin = transaction.getProperty(\'origin_id\')\n
+  sheet = transaction.getProperty(\'aggregate_title\')\n
+  obj = Object(\n
+               parent_portal_type=transaction.getTranslatedPortalType(),\n
+               parent_int_index="%05d" % transaction.getIntIndex(0),\n
+               parent_aggregate_title=sheet,\n
+               parent_origin_id=origin,\n
+               \n
+               mirror_section_uid=brain.mirror_section_uid,\n
+               section_uid=brain.section_uid,\n
+               node_relative_url=brain.node_relative_url,\n
+               getObject=brain.getObject,\n
+               asContext=movement.asContext,\n
+#               Movement_getExplanationUrl=movement.Movement_getExplanationUrl,\n
+\n
+               date=brain.date,\n
+               debit=max(brain.total_price, 0),\n
+               credit=max(-brain.total_price, 0), )\n
+  line_list.append(obj)\n
+  \n
+  if brain.node_relative_url:\n
+    # per account and origin\n
+    account = per_account_and_origin_cache.setdefault(\n
+                                      brain.node_relative_url, {})\n
+    total = account.setdefault(origin, 0)\n
+    account[origin] = total + (brain.total_price or 0)\n
+    # per origin and sheet\n
+    origin_cache = per_origin_and_sheet_cache.setdefault(origin, {})\n
+    total = origin_cache.setdefault((brain.node_relative_url, sheet), 0)\n
+    origin_cache[(brain.node_relative_url, sheet)] = total + (brain.total_price or 0)\n
 \n
 return line_list\n
 </string> </value>
@@ -118,12 +139,6 @@
         </item>
         <item>
             <key> <string>_filepath</string> </key>
-            <value>
-              <none/>
-            </value>
-        </item>
-        <item>
-            <key> <string>_owner</string> </key>
             <value>
               <none/>
             </value>
@@ -157,6 +172,8 @@
                         <value>
                           <tuple>
                             <string>kw</string>
+                            <string>Products.PythonScripts.standard</string>
+                            <string>Object</string>
                             <string>line_list</string>
                             <string>_getattr_</string>
                             <string>context</string>
@@ -164,18 +181,21 @@
                             <string>selection_name</string>
                             <string>accounting_movement_type_list</string>
                             <string>stool</string>
+                            <string>selection</string>
                             <string>per_account_and_origin_cache</string>
                             <string>per_origin_and_sheet_cache</string>
+                            <string>simtool</string>
+                            <string>_write_</string>
                             <string>_getiter_</string>
+                            <string>brain</string>
+                            <string>movement</string>
                             <string>transaction</string>
-                            <string>is_source</string>
                             <string>origin</string>
                             <string>sheet</string>
-                            <string>AttributeError</string>
-                            <string>line</string>
+                            <string>max</string>
+                            <string>obj</string>
                             <string>account</string>
                             <string>total</string>
-                            <string>_write_</string>
                             <string>origin_cache</string>
                           </tuple>
                         </value>

Modified: erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_viewM9AccountingTransactionListReportSection.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_viewM9AccountingTransactionListReportSection.xml?rev=11452&r1=11451&r2=11452&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_viewM9AccountingTransactionListReportSection.xml (original)
+++ erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_viewM9AccountingTransactionListReportSection.xml Wed Nov 22 23:21:21 2006
@@ -46,12 +46,6 @@
             </value>
         </item>
         <item>
-            <key> <string>_owner</string> </key>
-            <value>
-              <none/>
-            </value>
-        </item>
-        <item>
             <key> <string>action</string> </key>
             <value> <string></string> </value>
         </item>
@@ -88,10 +82,6 @@
                     <key>                 <string>hidden</string> </key>
                     <value>
                       <list>
-                        <string>listbox_parent_int_index</string>
-                        <string>listbox_parent_portal_type</string>
-                        <string>listbox_parent_origin_id</string>
-                        <string>listbox_parent_aggregate_title</string>
                         <string>listbox_credit</string>
                         <string>listbox_debit</string>
                         <string>listbox_date</string>

Modified: erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_viewM9AccountingTransactionListReportSection/listbox.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_viewM9AccountingTransactionListReportSection/listbox.xml?rev=11452&r1=11451&r2=11452&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_viewM9AccountingTransactionListReportSection/listbox.xml (original)
+++ erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_viewM9AccountingTransactionListReportSection/listbox.xml Wed Nov 22 23:21:21 2006
@@ -455,7 +455,7 @@
                 </item>
                 <item>
                     <key> <string>lines</string> </key>
-                    <value> <int>20</int> </value>
+                    <value> <int>0</int> </value>
                 </item>
                 <item>
                     <key> <string>list_action</string> </key>

Modified: erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_viewM9AccountingTransactionListReportSection/listbox_credit.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_viewM9AccountingTransactionListReportSection/listbox_credit.xml?rev=11452&r1=11451&r2=11452&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_viewM9AccountingTransactionListReportSection/listbox_credit.xml (original)
+++ erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_viewM9AccountingTransactionListReportSection/listbox_credit.xml Wed Nov 22 23:21:21 2006
@@ -13,12 +13,6 @@
     <pickle>
       <dictionary>
         <item>
-            <key> <string>_owner</string> </key>
-            <value>
-              <none/>
-            </value>
-        </item>
-        <item>
             <key> <string>id</string> </key>
             <value> <string>listbox_credit</string> </value>
         </item>
@@ -126,9 +120,7 @@
                 </item>
                 <item>
                     <key> <string>default</string> </key>
-                    <value>
-                      <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
-                    </value>
+                    <value> <string></string> </value>
                 </item>
                 <item>
                     <key> <string>description</string> </key>
@@ -255,25 +247,6 @@
                 </item>
               </dictionary>
             </value>
-        </item>
-      </dictionary>
-    </pickle>
-  </record>
-  <record id="2" aka="AAAAAAAAAAI=">
-    <pickle>
-      <tuple>
-        <tuple>
-          <string>Products.Formulator.TALESField</string>
-          <string>TALESMethod</string>
-        </tuple>
-        <none/>
-      </tuple>
-    </pickle>
-    <pickle>
-      <dictionary>
-        <item>
-            <key> <string>_text</string> </key>
-            <value> <string>python: -min(cell.total_price, 0)</string> </value>
         </item>
       </dictionary>
     </pickle>

Modified: erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_viewM9AccountingTransactionListReportSection/listbox_date.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_viewM9AccountingTransactionListReportSection/listbox_date.xml?rev=11452&r1=11451&r2=11452&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_viewM9AccountingTransactionListReportSection/listbox_date.xml (original)
+++ erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_viewM9AccountingTransactionListReportSection/listbox_date.xml Wed Nov 22 23:21:21 2006
@@ -12,12 +12,6 @@
     </pickle>
     <pickle>
       <dictionary>
-        <item>
-            <key> <string>_owner</string> </key>
-            <value>
-              <none/>
-            </value>
-        </item>
         <item>
             <key> <string>id</string> </key>
             <value> <string>listbox_date</string> </value>

Modified: erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_viewM9AccountingTransactionListReportSection/listbox_debit.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_viewM9AccountingTransactionListReportSection/listbox_debit.xml?rev=11452&r1=11451&r2=11452&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_viewM9AccountingTransactionListReportSection/listbox_debit.xml (original)
+++ erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/SkinTemplateItem/portal_skins/erp5_accounting_l10n_fr_m9/AccountingTransactionModule_viewM9AccountingTransactionListReportSection/listbox_debit.xml Wed Nov 22 23:21:21 2006
@@ -13,12 +13,6 @@
     <pickle>
       <dictionary>
         <item>
-            <key> <string>_owner</string> </key>
-            <value>
-              <none/>
-            </value>
-        </item>
-        <item>
             <key> <string>id</string> </key>
             <value> <string>listbox_debit</string> </value>
         </item>
@@ -126,9 +120,7 @@
                 </item>
                 <item>
                     <key> <string>default</string> </key>
-                    <value>
-                      <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
-                    </value>
+                    <value> <string></string> </value>
                 </item>
                 <item>
                     <key> <string>description</string> </key>
@@ -255,25 +247,6 @@
                 </item>
               </dictionary>
             </value>
-        </item>
-      </dictionary>
-    </pickle>
-  </record>
-  <record id="2" aka="AAAAAAAAAAI=">
-    <pickle>
-      <tuple>
-        <tuple>
-          <string>Products.Formulator.TALESField</string>
-          <string>TALESMethod</string>
-        </tuple>
-        <none/>
-      </tuple>
-    </pickle>
-    <pickle>
-      <dictionary>
-        <item>
-            <key> <string>_text</string> </key>
-            <value> <string>python: max(cell.total_price, 0)</string> </value>
         </item>
       </dictionary>
     </pickle>

Modified: erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/bt/revision?rev=11452&r1=11451&r2=11452&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/bt/revision (original)
+++ erp5/trunk/bt5/erp5_accounting_l10n_fr_m9/bt/revision Wed Nov 22 23:21:21 2006
@@ -1,1 +1,1 @@
-43
+44




More information about the Erp5-report mailing list