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

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Nov 22 22:34:24 CET 2006


Author: jerome
Date: Wed Nov 22 22:34:22 2006
New Revision: 11451

URL: http://svn.erp5.org?rev=11451&view=rev
Log:
Allow to reuse the generated SQL for accounting module selection in other queries


Modified:
    erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_getAccountingTransactionList.xml
    erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_zGetAccountingTransactionList.xml
    erp5/trunk/bt5/erp5_accounting/bt/revision

Modified: erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_getAccountingTransactionList.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_getAccountingTransactionList.xml?rev=11451&r1=11450&r2=11451&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_getAccountingTransactionList.xml (original)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_getAccountingTransactionList.xml Wed Nov 22 22:34:22 2006
@@ -91,11 +91,23 @@
 params[\'omit_input\'] = 0\n
 params[\'omit_output\'] = 0\n
 \n
+# XXX this workaround is probably no longer needed\n
 if params.get(\'delivery_start_date\'):\n
   params[\'delivery.start_date\'] = params[\'delivery_start_date\']\n
 \n
-#context.log(\'LOG (%s)\' % params,  context.AccountingTransactionModule_zGetAccountingTransactionList(src__ =1, selection_params=params, **params))\n
-return context.AccountingTransactionModule_zGetAccountingTransactionList(selection_params=params, **params)\n
+# this method can be used to build another complex query, for example\n
+# as a catalog.parent_uid filter with SimulationTool.getMovementList.\n
+# In this example, you can use side independant inventory API with \n
+# accounting module selection. see erp5_accounting_l10n_fr_m9 for an example.\n
+src__ = context.REQUEST.other.get(\'src__\', 0)\n
+no_limit = context.REQUEST.other.get(\'no_limit\', 0)\n
+search_result_keys = context.REQUEST.other.get(\'search_result_keys\', None)\n
+\n
+return context.AccountingTransactionModule_zGetAccountingTransactionList( \n
+                            selection_params=params,\n
+                            src__=src__,\n
+                            search_result_keys=search_result_keys,\n
+                            no_limit=no_limit, **params)\n
 
 
 ]]></string> </value>
@@ -144,8 +156,12 @@
                             <string>_write_</string>
                             <string>_getattr_</string>
                             <string>_getitem_</string>
+                            <string>context</string>
+                            <string>src__</string>
+                            <string>no_limit</string>
+                            <string>None</string>
+                            <string>search_result_keys</string>
                             <string>_apply_</string>
-                            <string>context</string>
                           </tuple>
                         </value>
                     </item>

Modified: erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_zGetAccountingTransactionList.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_zGetAccountingTransactionList.xml?rev=11451&r1=11450&r2=11451&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_zGetAccountingTransactionList.xml (original)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_zGetAccountingTransactionList.xml Wed Nov 22 22:34:22 2006
@@ -140,6 +140,12 @@
                                 </value>
                             </item>
                             <item>
+                                <key> <string>no_limit</string> </key>
+                                <value>
+                                  <dictionary/>
+                                </value>
+                            </item>
+                            <item>
                                 <key> <string>node</string> </key>
                                 <value>
                                   <dictionary>
@@ -179,6 +185,17 @@
                                     <item>
                                         <key> <string>default</string> </key>
                                         <value> <string></string> </value>
+                                    </item>
+                                  </dictionary>
+                                </value>
+                            </item>
+                            <item>
+                                <key> <string>search_result_keys</string> </key>
+                                <value>
+                                  <dictionary>
+                                    <item>
+                                        <key> <string>default</string> </key>
+                                        <value> <string encoding="base64">Jyc=</string> </value>
                                     </item>
                                   </dictionary>
                                 </value>
@@ -281,30 +298,32 @@
                         <key> <string>_keys</string> </key>
                         <value>
                           <list>
-                            <string>selection</string>
-                            <string>selection_domain</string>
-                            <string>selection_report</string>
-                            <string>selection_params</string>
-                            <string>selection_sort_on</string>
-                            <string>select_expression</string>
-                            <string>from_date</string>
-                            <string>at_date</string>
-                            <string>to_date</string>
-                            <string>node</string>
-                            <string>resource</string>
-                            <string>entity</string>
-                            <string>stat</string>
-                            <string>omit_input</string>
-                            <string>omit_output</string>
-                            <string>amount</string>
-                            <string>amount_range_min</string>
-                            <string>amount_range_max</string>
-                            <string>creation_date_range_min</string>
-                            <string>creation_date_range_max</string>
-                            <string>section_category</string>
-                            <string>count</string>
-                            <string>transaction_uid</string>
-                            <string>specific_reference</string>
+<string>selection</string>
+<string>selection_domain</string>
+<string>selection_report</string>
+<string>selection_params</string>
+<string>selection_sort_on</string>
+<string>select_expression</string>
+<string>from_date</string>
+<string>at_date</string>
+<string>to_date</string>
+<string>node</string>
+<string>resource</string>
+<string>entity</string>
+<string>stat</string>
+<string>omit_input</string>
+<string>omit_output</string>
+<string>amount</string>
+<string>amount_range_min</string>
+<string>amount_range_max</string>
+<string>creation_date_range_min</string>
+<string>creation_date_range_max</string>
+<string>section_category</string>
+<string>count</string>
+<string>transaction_uid</string>
+<string>specific_reference</string>
+<string>no_limit</string>
+<string>search_result_keys</string>
                           </list>
                         </value>
                     </item>
@@ -344,7 +363,9 @@
 section_category=""\r\n
 count=""\r\n
 transaction_uid=""\r\n
-specific_reference</string> </value>
+specific_reference\r\n
+no_limit\r\n
+search_result_keys=\'\'</string> </value>
         </item>
         <item>
             <key> <string>cache_time_</string> </key>
@@ -386,9 +407,8 @@
 
 <dtml-let allowed_roles_and_users="portal_catalog.getAllowedRolesAndUsers(**selection_params)">\n
 <dtml-comment>do something to have a query without RolesAndUsers security for global stats</dtml-comment>\n
-<dtml-let query="(stat) and portal_catalog.buildSQLQuery(**selection_params) or\n
-portal_catalog.buildSQLQuery(allowedRolesAndUsers=allowed_roles_and_users, **selection_params)">\n
-\n
+<dtml-let query="(stat) and portal_catalog.buildSQLQuery(**selection_params) or portal_catalog.buildSQLQuery(allowedRolesAndUsers=allowed_roles_and_users, **selection_params)">\n
+<dtml-let search_result_keys="search_result_keys or portal_catalog.getCatalogSearchResultKeys()">\n
 <dtml-let use_movement_table="from_date or to_date or at_date or resource or stat or amount or amount_range_min or amount_range_max">\n
 \n
 SELECT\n
@@ -398,7 +418,7 @@
     COUNT(DISTINCT catalog.uid) AS count\n
   <dtml-else>\n
     DISTINCT\n
-    <dtml-in "portal_catalog.getCatalogSearchResultKeys()">\n
+    <dtml-in "search_result_keys">\n
       <dtml-unless sequence-start>,</dtml-unless>\n
       <dtml-var sequence-item>\n
     </dtml-in>\n
@@ -528,10 +548,10 @@
   <dtml-if "query[\'limit_expression\']">\n
     LIMIT <dtml-var "query[\'limit_expression\']">\n
   <dtml-else>\n
-    LIMIT 1000\n
+    <dtml-unless no_limit>LIMIT 1000</dtml-unless>\n
   </dtml-if>\n
 </dtml-unless>\n
-</dtml-let></dtml-let></dtml-let>\n
+</dtml-let></dtml-let></dtml-let></dtml-let>\n
 <dtml-comment> vim: syntax=dtml\n
 </dtml-comment>\n
 
@@ -574,9 +594,8 @@
 
 <dtml-let allowed_roles_and_users="portal_catalog.getAllowedRolesAndUsers(**selection_params)">\n
 <dtml-comment>do something to have a query without RolesAndUsers security for global stats</dtml-comment>\n
-<dtml-let query="(stat) and portal_catalog.buildSQLQuery(**selection_params) or\n
-portal_catalog.buildSQLQuery(allowedRolesAndUsers=allowed_roles_and_users, **selection_params)">\n
-\n
+<dtml-let query="(stat) and portal_catalog.buildSQLQuery(**selection_params) or portal_catalog.buildSQLQuery(allowedRolesAndUsers=allowed_roles_and_users, **selection_params)">\n
+<dtml-let search_result_keys="search_result_keys or portal_catalog.getCatalogSearchResultKeys()">\n
 <dtml-let use_movement_table="from_date or to_date or at_date or resource or stat or amount or amount_range_min or amount_range_max">\n
 \n
 SELECT\n
@@ -586,7 +605,7 @@
     COUNT(DISTINCT catalog.uid) AS count\n
   <dtml-else>\n
     DISTINCT\n
-    <dtml-in "portal_catalog.getCatalogSearchResultKeys()">\n
+    <dtml-in "search_result_keys">\n
       <dtml-unless sequence-start>,</dtml-unless>\n
       <dtml-var sequence-item>\n
     </dtml-in>\n
@@ -716,10 +735,10 @@
   <dtml-if "query[\'limit_expression\']">\n
     LIMIT <dtml-var "query[\'limit_expression\']">\n
   <dtml-else>\n
-    LIMIT 1000\n
+    <dtml-unless no_limit>LIMIT 1000</dtml-unless>\n
   </dtml-if>\n
 </dtml-unless>\n
-</dtml-let></dtml-let></dtml-let>\n
+</dtml-let></dtml-let></dtml-let></dtml-let>\n
 <dtml-comment> vim: syntax=dtml\n
 </dtml-comment>\n
 

Modified: erp5/trunk/bt5/erp5_accounting/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/bt/revision?rev=11451&r1=11450&r2=11451&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/bt/revision (original)
+++ erp5/trunk/bt5/erp5_accounting/bt/revision Wed Nov 22 22:34:22 2006
@@ -1,1 +1,1 @@
-132
+134




More information about the Erp5-report mailing list