Commit 7ba6cf98 authored by Jérome Perrin's avatar Jérome Perrin

Allow to reuse the generated SQL for accounting module selection in other queries



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@11451 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 230f4c5d
...@@ -91,11 +91,23 @@ if params.get(\'count\', 0):\n ...@@ -91,11 +91,23 @@ if params.get(\'count\', 0):\n
params[\'omit_input\'] = 0\n params[\'omit_input\'] = 0\n
params[\'omit_output\'] = 0\n params[\'omit_output\'] = 0\n
\n \n
# XXX this workaround is probably no longer needed\n
if params.get(\'delivery_start_date\'):\n if params.get(\'delivery_start_date\'):\n
params[\'delivery.start_date\'] = params[\'delivery_start_date\']\n params[\'delivery.start_date\'] = params[\'delivery_start_date\']\n
\n \n
#context.log(\'LOG (%s)\' % params, context.AccountingTransactionModule_zGetAccountingTransactionList(src__ =1, selection_params=params, **params))\n # this method can be used to build another complex query, for example\n
return context.AccountingTransactionModule_zGetAccountingTransactionList(selection_params=params, **params)\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> ]]></string> </value>
...@@ -144,8 +156,12 @@ return context.AccountingTransactionModule_zGetAccountingTransactionList(selecti ...@@ -144,8 +156,12 @@ return context.AccountingTransactionModule_zGetAccountingTransactionList(selecti
<string>_write_</string> <string>_write_</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>_getitem_</string> <string>_getitem_</string>
<string>_apply_</string>
<string>context</string> <string>context</string>
<string>src__</string>
<string>no_limit</string>
<string>None</string>
<string>search_result_keys</string>
<string>_apply_</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -139,6 +139,12 @@ ...@@ -139,6 +139,12 @@
</dictionary> </dictionary>
</value> </value>
</item> </item>
<item>
<key> <string>no_limit</string> </key>
<value>
<dictionary/>
</value>
</item>
<item> <item>
<key> <string>node</string> </key> <key> <string>node</string> </key>
<value> <value>
...@@ -183,6 +189,17 @@ ...@@ -183,6 +189,17 @@
</dictionary> </dictionary>
</value> </value>
</item> </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>
</item>
<item> <item>
<key> <string>section_category</string> </key> <key> <string>section_category</string> </key>
<value> <value>
...@@ -281,30 +298,32 @@ ...@@ -281,30 +298,32 @@
<key> <string>_keys</string> </key> <key> <string>_keys</string> </key>
<value> <value>
<list> <list>
<string>selection</string> <string>selection</string>
<string>selection_domain</string> <string>selection_domain</string>
<string>selection_report</string> <string>selection_report</string>
<string>selection_params</string> <string>selection_params</string>
<string>selection_sort_on</string> <string>selection_sort_on</string>
<string>select_expression</string> <string>select_expression</string>
<string>from_date</string> <string>from_date</string>
<string>at_date</string> <string>at_date</string>
<string>to_date</string> <string>to_date</string>
<string>node</string> <string>node</string>
<string>resource</string> <string>resource</string>
<string>entity</string> <string>entity</string>
<string>stat</string> <string>stat</string>
<string>omit_input</string> <string>omit_input</string>
<string>omit_output</string> <string>omit_output</string>
<string>amount</string> <string>amount</string>
<string>amount_range_min</string> <string>amount_range_min</string>
<string>amount_range_max</string> <string>amount_range_max</string>
<string>creation_date_range_min</string> <string>creation_date_range_min</string>
<string>creation_date_range_max</string> <string>creation_date_range_max</string>
<string>section_category</string> <string>section_category</string>
<string>count</string> <string>count</string>
<string>transaction_uid</string> <string>transaction_uid</string>
<string>specific_reference</string> <string>specific_reference</string>
<string>no_limit</string>
<string>search_result_keys</string>
</list> </list>
</value> </value>
</item> </item>
...@@ -344,7 +363,9 @@ creation_date_range_max=""\r\n ...@@ -344,7 +363,9 @@ creation_date_range_max=""\r\n
section_category=""\r\n section_category=""\r\n
count=""\r\n count=""\r\n
transaction_uid=""\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>
<item> <item>
<key> <string>cache_time_</string> </key> <key> <string>cache_time_</string> </key>
...@@ -386,9 +407,8 @@ specific_reference</string> </value> ...@@ -386,9 +407,8 @@ specific_reference</string> </value>
<dtml-let allowed_roles_and_users="portal_catalog.getAllowedRolesAndUsers(**selection_params)">\n <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-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 <dtml-let query="(stat) and portal_catalog.buildSQLQuery(**selection_params) or portal_catalog.buildSQLQuery(allowedRolesAndUsers=allowed_roles_and_users, **selection_params)">\n
portal_catalog.buildSQLQuery(allowedRolesAndUsers=allowed_roles_and_users, **selection_params)">\n <dtml-let search_result_keys="search_result_keys or portal_catalog.getCatalogSearchResultKeys()">\n
\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 <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 \n
SELECT\n SELECT\n
...@@ -398,7 +418,7 @@ SELECT\n ...@@ -398,7 +418,7 @@ SELECT\n
COUNT(DISTINCT catalog.uid) AS count\n COUNT(DISTINCT catalog.uid) AS count\n
<dtml-else>\n <dtml-else>\n
DISTINCT\n DISTINCT\n
<dtml-in "portal_catalog.getCatalogSearchResultKeys()">\n <dtml-in "search_result_keys">\n
<dtml-unless sequence-start>,</dtml-unless>\n <dtml-unless sequence-start>,</dtml-unless>\n
<dtml-var sequence-item>\n <dtml-var sequence-item>\n
</dtml-in>\n </dtml-in>\n
...@@ -528,10 +548,10 @@ WHERE\n ...@@ -528,10 +548,10 @@ WHERE\n
<dtml-if "query[\'limit_expression\']">\n <dtml-if "query[\'limit_expression\']">\n
LIMIT <dtml-var "query[\'limit_expression\']">\n LIMIT <dtml-var "query[\'limit_expression\']">\n
<dtml-else>\n <dtml-else>\n
LIMIT 1000\n <dtml-unless no_limit>LIMIT 1000</dtml-unless>\n
</dtml-if>\n </dtml-if>\n
</dtml-unless>\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> vim: syntax=dtml\n
</dtml-comment>\n </dtml-comment>\n
...@@ -574,9 +594,8 @@ WHERE\n ...@@ -574,9 +594,8 @@ WHERE\n
<dtml-let allowed_roles_and_users="portal_catalog.getAllowedRolesAndUsers(**selection_params)">\n <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-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 <dtml-let query="(stat) and portal_catalog.buildSQLQuery(**selection_params) or portal_catalog.buildSQLQuery(allowedRolesAndUsers=allowed_roles_and_users, **selection_params)">\n
portal_catalog.buildSQLQuery(allowedRolesAndUsers=allowed_roles_and_users, **selection_params)">\n <dtml-let search_result_keys="search_result_keys or portal_catalog.getCatalogSearchResultKeys()">\n
\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 <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 \n
SELECT\n SELECT\n
...@@ -586,7 +605,7 @@ SELECT\n ...@@ -586,7 +605,7 @@ SELECT\n
COUNT(DISTINCT catalog.uid) AS count\n COUNT(DISTINCT catalog.uid) AS count\n
<dtml-else>\n <dtml-else>\n
DISTINCT\n DISTINCT\n
<dtml-in "portal_catalog.getCatalogSearchResultKeys()">\n <dtml-in "search_result_keys">\n
<dtml-unless sequence-start>,</dtml-unless>\n <dtml-unless sequence-start>,</dtml-unless>\n
<dtml-var sequence-item>\n <dtml-var sequence-item>\n
</dtml-in>\n </dtml-in>\n
...@@ -716,10 +735,10 @@ WHERE\n ...@@ -716,10 +735,10 @@ WHERE\n
<dtml-if "query[\'limit_expression\']">\n <dtml-if "query[\'limit_expression\']">\n
LIMIT <dtml-var "query[\'limit_expression\']">\n LIMIT <dtml-var "query[\'limit_expression\']">\n
<dtml-else>\n <dtml-else>\n
LIMIT 1000\n <dtml-unless no_limit>LIMIT 1000</dtml-unless>\n
</dtml-if>\n </dtml-if>\n
</dtml-unless>\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> vim: syntax=dtml\n
</dtml-comment>\n </dtml-comment>\n
......
132 134
\ 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