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
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 @@ return context.AccountingTransactionModule_zGetAccountingTransactionList(selecti
<string>_write_</string>
<string>_getattr_</string>
<string>_getitem_</string>
<string>_apply_</string>
<string>context</string>
<string>src__</string>
<string>no_limit</string>
<string>None</string>
<string>search_result_keys</string>
<string>_apply_</string>
</tuple>
</value>
</item>
......
......@@ -139,6 +139,12 @@
</dictionary>
</value>
</item>
<item>
<key> <string>no_limit</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>node</string> </key>
<value>
......@@ -183,6 +189,17 @@
</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>
</item>
<item>
<key> <string>section_category</string> </key>
<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 @@ creation_date_range_max=""\r\n
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 @@ specific_reference</string> </value>
<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 @@ SELECT\n
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 @@ WHERE\n
<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 @@ WHERE\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-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 @@ SELECT\n
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 @@ WHERE\n
<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
......
132
\ No newline at end of file
134
\ 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