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

Better query to get transactions where we are source_section with start_date...

Better query to get transactions where we are source_section with start_date in range or destination_section with stop_date in range

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17313 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c729b25f
...@@ -3,11 +3,8 @@ ...@@ -3,11 +3,8 @@
<record id="1" aka="AAAAAAAAAAE="> <record id="1" aka="AAAAAAAAAAE=">
<pickle> <pickle>
<tuple> <tuple>
<tuple> <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<string>Products.PythonScripts.PythonScript</string> <tuple/>
<string>PythonScript</string>
</tuple>
<none/>
</tuple> </tuple>
</pickle> </pickle>
<pickle> <pickle>
...@@ -86,15 +83,25 @@ invalid_simulation_state_list = [state for state in all_state_list\n ...@@ -86,15 +83,25 @@ invalid_simulation_state_list = [state for state in all_state_list\n
\n \n
section_uid = period.getParentUid()\n section_uid = period.getParentUid()\n
search_params = {\n search_params = {\n
\'delivery.start_date\': dict(query=period.getStartDate(),\n
range=\'min\'),\n
\'delivery.stop_date\': dict(query=period.getStopDate(),\n
range=\'ngt\'),\n
\'simulation_state\': invalid_simulation_state_list,\n \'simulation_state\': invalid_simulation_state_list,\n
\'portal_type\': portal.getPortalAccountingTransactionTypeList(),\n \'portal_type\': portal.getPortalAccountingTransactionTypeList(),\n
\'query\': ComplexQuery(Query(source_section_uid=section_uid),\n \'query\': ComplexQuery( \n
Query(destination_section_uid=section_uid),\n \n
operator=\'OR\')\n ComplexQuery( \n
Query(source_section_uid=section_uid),\n
Query(**{\'delivery.start_date\': [period.getStartDate(),\n
period.getStopDate()],\n
\'range\': \'minngt\'}),\n
operator=\'AND\'),\n
\n
ComplexQuery( \n
Query(destination_section_uid=section_uid),\n
Query(**{\'delivery.stop_date\': [period.getStartDate(),\n
period.getStopDate()], \n
\'range\': \'minngt\'}),\n
operator=\'AND\'),\n
\n
operator=\'OR\')\n
}\n }\n
\n \n
transaction_list = portal.portal_catalog.searchResults(**search_params)\n transaction_list = portal.portal_catalog.searchResults(**search_params)\n
...@@ -166,9 +173,8 @@ if transaction_list:\n ...@@ -166,9 +173,8 @@ if transaction_list:\n
<string>state</string> <string>state</string>
<string>invalid_simulation_state_list</string> <string>invalid_simulation_state_list</string>
<string>section_uid</string> <string>section_uid</string>
<string>dict</string>
<string>search_params</string>
<string>_apply_</string> <string>_apply_</string>
<string>search_params</string>
<string>transaction_list</string> <string>transaction_list</string>
</tuple> </tuple>
</value> </value>
......
461 462
\ 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