Commit 9c4f19b1 authored by Jérome Perrin's avatar Jérome Perrin

accounting: improve grouping reference fast input

- columns are now searchable
- title display line title if any; for consistency with all other reports
- title is no longer sortable properly. This is a little regression.
- use queries instead of raw where expression
parent ec1b8ba1
......@@ -50,7 +50,11 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>request = container.REQUEST\n
<value> <string encoding="cdata"><![CDATA[
from Products.ZSQLCatalog.SQLCatalog import Query, NegatedQuery, ComplexQuery\n
\n
request = container.REQUEST\n
portal = context.getPortalObject()\n
ctool = portal.portal_catalog\n
stool = portal.portal_simulation\n
......@@ -89,22 +93,42 @@ if mirror_section:\n
mirror_section).getUid()\n
\n
if grouping == \'grouping\':\n
where_expression = \'catalog.grouping_reference is NULL\'\n
search_kw[\'grouping_reference\'] = None\n
else:\n
assert grouping == \'ungrouping\', grouping\n
where_expression = \'catalog.grouping_reference is not NULL\'\n
\n
search_kw[\'grouping_reference\'] = NegatedQuery(Query(grouping_reference=None))\n
\n
if title:\n
search_kw[\'title_query\'] = ComplexQuery(Query(title=title),\n
Query(parent_title=title),\n
operator=\'OR\')\n
if delivery_reference:\n
search_kw[\'parent_reference\'] = delivery_reference\n
if debit_price:\n
search_kw[\'stock.total_price\'] = debit_price\n
if credit_price:\n
try:\n
search_kw[\'stock.total_price\'] = - float(credit_price[\'query\'])\n
except ValueError, e:\n
# happens when user entered a complex query (like "> 100 AND < 200")\n
# in that case, there is not much we can do.\n
search_kw[\'stock.total_price\'] = credit_price[\'query\']\n
if date:\n
search_kw[\'stock.date\'] = date\n
\n
\n
return stool.getMovementHistoryList(\n
section_uid=section_uid,\n
simulation_state=[\'stopped\', \'delivered\'],\n
where_expression=where_expression,\n
sort_on=sort_on,\n
**search_kw)\n
</string> </value>
]]></string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>selection=None, grouping=\'grouping\', node=\'\', mirror_section=\'\', **kw</string> </value>
<value> <string>selection=None, grouping=\'grouping\', node=\'\', mirror_section=\'\', title=None, delivery_reference=None, debit_price=None, credit_price=None, date=None, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -88,6 +88,7 @@
<string>listbox_delivery_portal_type</string>
<string>listbox_node_title</string>
<string>listbox_date</string>
<string>listbox_title</string>
</list>
</value>
</item>
......
......@@ -15,6 +15,8 @@
<string>editable_columns</string>
<string>lines</string>
<string>list_method</string>
<string>search</string>
<string>search_columns</string>
<string>select</string>
<string>selection_name</string>
<string>sort</string>
......@@ -147,7 +149,7 @@
<string>Date</string>
</tuple>
<tuple>
<string>parent_title</string>
<string>title</string>
<string>Title</string>
</tuple>
<tuple>
......@@ -177,6 +179,10 @@
<string>date</string>
<string>Date</string>
</tuple>
<tuple>
<string>title</string>
<string>Title</string>
</tuple>
<tuple>
<string>debit_price</string>
<string>Debit</string>
......@@ -206,6 +212,37 @@
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>search</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>search_columns</string> </key>
<value>
<list>
<tuple>
<string>debit_price</string>
<string>Debit</string>
</tuple>
<tuple>
<string>credit_price</string>
<string>Credit</string>
</tuple>
<tuple>
<string>delivery_reference</string>
<string>Transaction Reference</string>
</tuple>
<tuple>
<string>title</string>
<string>Title</string>
</tuple>
<tuple>
<string>date</string>
<string>Date</string>
</tuple>
</list>
</value>
</item>
<item>
<key> <string>select</string> </key>
<value> <int>1</int> </value>
......@@ -246,7 +283,7 @@
<string>Date</string>
</tuple>
<tuple>
<string>parent_title</string>
<string>title</string>
<string>Title</string>
</tuple>
</list>
......
1549
\ No newline at end of file
1550
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_text</string> </key>
<value> <unicode encoding="cdata"><![CDATA[
<html>\n
<head><title>Sorting in Grouping Dialog</title></head>\n
<body>\n
<table cellpadding="1" cellspacing="1" border="1">\n
<thead>\n
<tr><td rowspan="1" colspan="4">\n
Sorting in Grouping Dialog\n
</td></tr>\n
</thead><tbody tal:define="init_method string:AccountingZuite_createAccountingTransactionList?add_draft_transactions:int=0&add_related_payments:int=1">\n
\n
<!-- Setup {{{ -->\n
<tal:block metal:use-macro="here/AccountingZuite_CommonTemplate/macros/init"/>\n
<tr>\n
<td>selectAndWait</td>\n
<td>select_module</td>\n
<td>Accounts</td>\n
</tr>\n
<tr>\n
<td>clickAndWait</td>\n
<td>Folder_show:method</td>\n
<td></td>\n
</tr>\n
<!-- }}} -->\n
\n
<!-- {{{ Select Receivable account and use grouping fast input -->\n
<tr>\n
<td>clickAndWait</td>\n
<td>link=Receivable</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>clickAndWait</td>\n
<td>//img[@alt=\'Grouping Reference Fast Input\']</td>\n
<td></td>\n
</tr>\n
\n
<tr>\n
<td>verifyText</td>\n
<td>//span[@class="listbox-current-page-total-number"]</td>\n
<td>4 records</td>\n
</tr>\n
\n
<tr>\n
<td>type</td>\n
<!-- debit -->\n
<td>//tr[@class=\'listbox-search-line\']/th[3]/input</td> \n
<td>2200</td>\n
</tr>\n
<tr>\n
<td>clickAndWait</td>\n
<td>//input[@class="listbox-select-action"]</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>verifyText</td>\n
<td>//span[@class="listbox-current-page-total-number"]</td>\n
<td>1 records</td>\n
</tr>\n
\n
<tr>\n
<td>type</td>\n
<!-- reset debit -->\n
<td>//tr[@class=\'listbox-search-line\']/th[3]/input</td> \n
<td></td>\n
</tr>\n
<tr>\n
<td>type</td>\n
<!-- credit -->\n
<td>//tr[@class=\'listbox-search-line\']/th[4]/input</td> \n
<td>2200</td>\n
</tr>\n
<tr>\n
<td>clickAndWait</td>\n
<td>//input[@class="listbox-select-action"]</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>verifyText</td>\n
<td>//span[@class="listbox-current-page-total-number"]</td>\n
<td>1 records</td>\n
</tr>\n
\n
<tr>\n
<td>type</td>\n
<!-- reset credit -->\n
<td>//tr[@class=\'listbox-search-line\']/th[4]/input</td> \n
<td></td>\n
</tr>\n
<tr>\n
<td>type</td>\n
<!-- explanation reference. As this is generated, we just use % -->\n
<td>//tr[@class=\'listbox-search-line\']/th[5]/input</td> \n
<td>%</td>\n
</tr>\n
<tr>\n
<td>clickAndWait</td>\n
<td>//input[@class="listbox-select-action"]</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>verifyText</td>\n
<td>//span[@class="listbox-current-page-total-number"]</td>\n
<td>2 records</td> <!-- in our test data set, only invoices have reference, not payments -->\n
</tr>\n
\n
<tr>\n
<td>type</td>\n
<!-- reset explanation reference -->\n
<td>//tr[@class=\'listbox-search-line\']/th[5]/input</td> \n
<td></td>\n
</tr>\n
<tr>\n
<td>type</td>\n
<!-- date -->\n
<td>//tr[@class=\'listbox-search-line\']/th[6]/input</td> \n
<td>2005/01/02</td>\n
</tr>\n
<tr>\n
<td>clickAndWait</td>\n
<td>//input[@class="listbox-select-action"]</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>verifyText</td>\n
<td>//span[@class="listbox-current-page-total-number"]</td>\n
<td>2 records</td>\n
</tr>\n
\n
<tr>\n
<td>type</td>\n
<!-- reset date -->\n
<td>//tr[@class=\'listbox-search-line\']/th[6]/input</td> \n
<td></td>\n
</tr>\n
<tr>\n
<td>type</td>\n
<!-- title -->\n
<td>//tr[@class=\'listbox-search-line\']/th[7]/input</td> \n
<td>Client 1 Payment</td>\n
</tr>\n
<tr>\n
<td>clickAndWait</td>\n
<td>//input[@class="listbox-select-action"]</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>verifyText</td>\n
<td>//span[@class="listbox-current-page-total-number"]</td>\n
<td>1 records</td>\n
</tr>\n
\n
\n
</tbody></table>\n
</body>\n
</html> <!-- vim: syntax=html foldmethod=marker\n
-->
]]></unicode> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test_group_dialog_searching.html</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -134,86 +134,7 @@ Sorting in Grouping Dialog\n
</tr>\n
<!-- }}} -->\n
\n
<!-- Sort by title asc {{{ -->\n
<tr>\n
<td>assertElementPresent</td>\n
<td>//tr[@class=\'listbox-label-line\']/th[6]/button[@value="listbox.date:none"]</td>\n
<td></td>\n
</tr>\n
<tr>\n
<!-- reset date sorting -->\n
<td>clickAndWait</td>\n
<td>//tr[@class=\'listbox-label-line\']/th[6]/button[@value="listbox.date:none"]</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>clickAndWait</td>\n
<td>//tr[@class=\'listbox-label-line\']/th[7]/button[@value="listbox.parent_title:asc"]</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>verifyText</td>\n
<td>//tr[@class=\'listbox-data-line-0 DataA\']/td[7]/a</td>\n
<td>Client 1 Payment</td>\n
</tr>\n
<tr>\n
<td>verifyText</td>\n
<td>//tr[@class=\'listbox-data-line-1 DataB\']/td[7]/a</td>\n
<td>Client 1 Sale Invoice</td>\n
</tr>\n
<tr>\n
<td>verifyText</td>\n
<td>//tr[@class=\'listbox-data-line-2 DataA\']/td[7]/a</td>\n
<td>Client 2 Payment</td>\n
</tr>\n
<tr>\n
<td>verifyText</td>\n
<td>//tr[@class=\'listbox-data-line-3 DataB\']/td[7]/a</td>\n
<td>Client 2 Sale Invoice</td>\n
</tr>\n
<!-- }}} -->\n
\n
<!-- Sort by title desc {{{ -->\n
<tr>\n
<td>clickAndWait</td>\n
<td>//tr[@class=\'listbox-label-line\']/th[7]/button[@value="listbox.parent_title:desc"]</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>verifyText</td>\n
<td>//tr[@class=\'listbox-data-line-3 DataB\']/td[7]/a</td>\n
<td>Client 1 Payment</td>\n
</tr>\n
<tr>\n
<td>verifyText</td>\n
<td>//tr[@class=\'listbox-data-line-2 DataA\']/td[7]/a</td>\n
<td>Client 1 Sale Invoice</td>\n
</tr>\n
<tr>\n
<td>verifyText</td>\n
<td>//tr[@class=\'listbox-data-line-1 DataB\']/td[7]/a</td>\n
<td>Client 2 Payment</td>\n
</tr>\n
<tr>\n
<td>verifyText</td>\n
<td>//tr[@class=\'listbox-data-line-0 DataA\']/td[7]/a</td>\n
<td>Client 2 Sale Invoice</td>\n
</tr>\n
<!-- }}} -->\n
\n
<!-- Sort by grouping reference asc {{{ -->\n
<tr>\n
<!-- reset title sorting -->\n
<td>assertElementPresent</td>\n
<td>//tr[@class=\'listbox-label-line\']/th[7]/button[@value="listbox.parent_title:none"]</td>\n
<td></td>\n
</tr>\n
<tr>\n
<!-- reset title sorting -->\n
<td>clickAndWait</td>\n
<td>//tr[@class=\'listbox-label-line\']/th[7]/button[@value="listbox.parent_title:none"]</td>\n
<td></td>\n
</tr>\n
<tr>\n
<!-- XXX-Tatuya: For what purpose of this sort? -->\n
<td>clickAndWait</td>\n
......
201
\ No newline at end of file
202
\ 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