Commit 6a962b0b authored by Jérome Perrin's avatar Jérome Perrin

Modify grouping fast input to start in grouping mode by default, and replace...

Modify grouping fast input to start in grouping mode by default, and replace the check box by a combo box, it's more intuitive

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19882 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 88264ea7
......@@ -72,11 +72,8 @@ stool = portal.portal_simulation\n
\n
# we use a different selection for dialog params, because we never want this\n
# selection to be reseteted\n
dialog_params_selection = portal.portal_selections.getSelectionFor(\n
dialog_selection_params = portal.portal_selections.getSelectionParamsFor(\n
\'grouping_reference_fast_input_selection\')\n
selection_params = {}\n
if dialog_params_selection is not None:\n
selection_params = dialog_params_selection.getParams()\n
\n
# support pseudo sorting; sorting is done by uid.\n
orig_sort_on = portal.portal_selections.getSelectionSortOrder(\n
......@@ -92,11 +89,10 @@ extra_query_keys = {}\n
section_uid = portal.Base_getSectionUidListForSectionCategory(\n
portal.portal_preferences.getPreferredAccountingTransactionSectionCategory())\n
\n
# unconditionnaly get from dialog selection\n
grouping = selection_params.get(\'grouping\')\n
grouping = dialog_selection_params.get(\'grouping\', \'grouping\')\n
\n
search_kw = dict()\n
node = node or request.get(\'node\') or selection_params.get(\'node\')\n
node = node or request.get(\'node\') or dialog_selection_params.get(\'node\')\n
if node:\n
search_kw[\'node_uid\'] = portal.restrictedTraverse(node).getUid()\n
mirror_section = mirror_section or request.get(\'mirror_section\')\n
......@@ -104,9 +100,10 @@ if mirror_section:\n
search_kw[\'mirror_section_uid\'] = portal.restrictedTraverse(\n
mirror_section).getUid()\n
\n
if grouping:\n
if grouping == \'grouping\':\n
where_expression = \'catalog.grouping_reference is NULL\'\n
else:\n
assert grouping == \'ungrouping\', grouping\n
where_expression = \'catalog.grouping_reference is not NULL\'\n
\n
return stool.getMovementHistoryList(\n
......@@ -137,7 +134,7 @@ return stool.getMovementHistoryList(\n
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>selection=None, grouping=0, node=\'\', mirror_section=\'\', **kw</string> </value>
<value> <string>selection=None, grouping=\'grouping\', node=\'\', mirror_section=\'\', **kw</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
......@@ -175,9 +172,7 @@ return stool.getMovementHistoryList(\n
<string>portal</string>
<string>ctool</string>
<string>stool</string>
<string>dialog_params_selection</string>
<string>selection_params</string>
<string>None</string>
<string>dialog_selection_params</string>
<string>orig_sort_on</string>
<string>sort_on</string>
<string>_getiter_</string>
......@@ -190,6 +185,7 @@ return stool.getMovementHistoryList(\n
<string>search_kw</string>
<string>_write_</string>
<string>where_expression</string>
<string>AssertionError</string>
<string>_apply_</string>
</tuple>
</value>
......@@ -204,7 +200,7 @@ return stool.getMovementHistoryList(\n
<value>
<tuple>
<none/>
<int>0</int>
<string>grouping</string>
<string></string>
<string></string>
</tuple>
......
......@@ -75,16 +75,19 @@ getobject = portal.portal_catalog.getobject\n
N_ = portal.Base_translateString\n
psm = N_(\'Nothing matches\')\n
reset = 0\n
precision = context.REQUEST.get(\'precision\', 2)\n
request = container.REQUEST\n
precision = request.get(\'precision\', 2)\n
\n
# XXX when should it be validated ?\n
if node == \'\':\n
node = context.REQUEST.get(\'field_your_node\', node)\n
if mirror_section == \'\':\n
mirror_section = context.REQUEST.get(\'field_your_mirror_section\',\n
mirror_section)\n
mirror_section)\n
if grouping == \'\':\n
grouping = context.REQUEST.get(\'field_your_grouping\', grouping)\n
grouping = request.get(\'your_grouping\',\n
request.get(\'field_your_grouping\',\n
grouping))\n
\n
# edit selection for dialog parameters\n
portal.portal_selections.setSelectionParamsFor(\n
......@@ -102,6 +105,7 @@ if uids:\n
total_selected_amount += (line.getSourceInventoriatedTotalAssetPrice() or 0)\n
else:\n
total_selected_amount += (line.getDestinationInventoriatedTotalAssetPrice() or 0)\n
request.set(\'total_selected_amount\', total_selected_amount)\n
\n
if update:\n
# update selected uids \n
......@@ -109,19 +113,12 @@ if update:\n
selection_name, uids=uids, listbox_uid=listbox_uid,\n
REQUEST=context.REQUEST)\n
\n
psm = N_(\'Updated\')\n
return context.REQUEST.RESPONSE.redirect(\n
\'%s/AccountingTransactionModule_viewGroupingFastInputDialog?%s\' % (\n
context.absolute_url(),\n
make_query(dict(node=node,\n
grouping=grouping,\n
mirror_section=mirror_section,\n
cancel_url=cancel_url,\n
total_selected_amount=total_selected_amount,\n
portal_status_message=psm))))\n
request.set(\'portal_status_message\', N_(\'Updated\'))\n
return context.AccountingTransactionModule_viewGroupingFastInputDialog(request)\n
\n
\n
# otherwise, try to group...\n
if grouping:\n
if grouping == \'grouping\':\n
grouped_line_list = context.AccountingTransaction_guessGroupedLines(\n
accounting_transaction_line_uid_list=uids)\n
if grouped_line_list:\n
......@@ -166,6 +163,7 @@ if grouping:\n
# Workflow action not supported\n
pass\n
else:\n
assert grouping == \'ungrouping\'\n
# or to ungroup based on how we are called.\n
amount_per_node_mirror_section = dict()\n
# XXX is uids multi page safe here ?\n
......@@ -202,16 +200,8 @@ else:\n
else:\n
psm = N_(\'Ungrouping refused. Check your selection\')\n
\n
context.REQUEST.RESPONSE.redirect(\n
\'%s/AccountingTransactionModule_viewGroupingFastInputDialog?%s\' % (\n
context.absolute_url(),\n
make_query(dict(node=node,\n
grouping=grouping,\n
mirror_section=mirror_section,\n
cancel_url=cancel_url,\n
total_selected_amount=total_selected_amount,\n
reset=reset,\n
portal_status_message=psm))))\n
request.set(\'portal_status_message\', psm)\n
return context.AccountingTransactionModule_viewGroupingFastInputDialog(request)\n
</string> </value>
</item>
<item>
......@@ -234,7 +224,7 @@ context.REQUEST.RESPONSE.redirect(\n
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>uids=[], listbox=None, listbox_uid=[], selection_name=\'\', grouping=\'\', node=\'\', mirror_section=\'\', cancel_url=\'\', update=0, **kw</string> </value>
<value> <string>uids=[], listbox=None, listbox_uid=[], selection_name=\'\', grouping=\'\', node=\'\', mirror_section=\'\', update=0, **kw</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
......@@ -254,7 +244,7 @@ context.REQUEST.RESPONSE.redirect(\n
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>9</int> </value>
<value> <int>8</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
......@@ -267,7 +257,6 @@ context.REQUEST.RESPONSE.redirect(\n
<string>grouping</string>
<string>node</string>
<string>mirror_section</string>
<string>cancel_url</string>
<string>update</string>
<string>kw</string>
<string>ZTUtils</string>
......@@ -281,6 +270,8 @@ context.REQUEST.RESPONSE.redirect(\n
<string>N_</string>
<string>psm</string>
<string>reset</string>
<string>container</string>
<string>request</string>
<string>precision</string>
<string>dict</string>
<string>total_selected_amount</string>
......@@ -298,6 +289,7 @@ context.REQUEST.RESPONSE.redirect(\n
<string>cleared</string>
<string>account</string>
<string>date</string>
<string>AssertionError</string>
<string>amount_per_node_mirror_section</string>
<string>append</string>
<string>$append0</string>
......@@ -329,7 +321,6 @@ context.REQUEST.RESPONSE.redirect(\n
<string></string>
<string></string>
<string></string>
<string></string>
<int>0</int>
</tuple>
</value>
......
......@@ -76,8 +76,7 @@ return context.AccountingTransactionModule_setGroupingReference(\n
selection_name=list_selection_name,\n
node=node,\n
mirror_section=mirror_section,\n
update=1,\n
cancel_url=cancel_url)\n
update=1)\n
</string> </value>
</item>
<item>
......
......@@ -3,12 +3,18 @@
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="CheckBoxField" module="Products.Formulator.StandardFields"/>
<global name="RadioField" module="Products.Formulator.StandardFields"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>your_grouping</string> </value>
......@@ -21,6 +27,14 @@
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
<item>
<key> <string>required_not_found</string> </key>
<value> <string>Input is required but no input given.</string> </value>
</item>
<item>
<key> <string>unknown_selection</string> </key>
<value> <string>You selected an item that was not in the list.</string> </value>
</item>
</dictionary>
</value>
</item>
......@@ -57,17 +71,41 @@
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<key> <string>extra_item</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>first_item</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>orientation</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
......@@ -106,17 +144,43 @@
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<key> <string>extra_item</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>first_item</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>orientation</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
......@@ -134,7 +198,7 @@
</item>
<item>
<key> <string>default</string> </key>
<value> <int>0</int> </value>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
......@@ -153,16 +217,42 @@
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<key> <string>extra_item</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>first_item</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>orientation</string> </key>
<value> <string>vertical</string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Grouping (or ungroupping)</string> </value>
<value> <string>Mode</string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary>
</value>
......@@ -181,7 +271,23 @@
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>request/grouping | python:here.portal_selections.getSelectionParamsFor(\'grouping_reference_fast_input_selection\').get(\'grouping\', 0)</string> </value>
<value> <string>request/grouping | python:here.portal_selections.getSelectionParamsFor(\'grouping_reference_fast_input_selection\').get(\'grouping\', \'grouping\')</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<tuple>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: [(context.Base_translateString(\'Grouping\'), \'grouping\'), (context.Base_translateString(\'Ungrouping\'), \'ungrouping\'),]</string> </value>
</item>
</dictionary>
</pickle>
......
639
\ No newline at end of file
640
\ 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