Commit fa3caa00 authored by Arnaud Fontaine's avatar Arnaud Fontaine

erp5_core: Fix ListMode view for ListBox with several tabs.

1. On Tab1, from PurchaseSupply_view, click on 'Purchase Supply Lines':
   Base_viewListMode??proxy_form_id=PurchaseSupply_view&proxy_field_id=listbox

   This Python Script initialise 'list_mode_proxy_selection' with the
   above 2 GET parameters and then displays PurchaseSupply_view.listbox
   indirectly but current Form is Base_viewListModeRenderer.

2. On Tab2, from SaleSupply_view, click on 'Sale Supply Lines':
   Base_viewListMode?proxy_form_id=SaleSupply_view&proxy_field_id=listbox

   This Python Script initialise 'list_mode_proxy_selection' with the
   above 2 GET parameters and then displays SaleSupply_view.listbox
   indirectly but current Form is Base_viewListModeRenderer.

3. On Tab1, filter Purchase Supply Lines.

   As proxy_form_id and proxy_field_id are not given, then
   Base_viewListModeRender fallbacks on 'list_mode_proxy_selection'
   values to find out the Form ID to be called and wrongly display
   SaleSupply_view.listbox (2.).
parent f67d4879
...@@ -607,7 +607,7 @@ ...@@ -607,7 +607,7 @@
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
string:Base_viewListMode?proxy_form_id=${form/getId}&proxy_field_id=${field/getId} string:Base_viewListMode?proxy_form_id=${form/getId}&proxy_field_id=${field/getId}&proxy_field_selection_name=${field/selection_name}
]]></string> </value> ]]></string> </value>
</item> </item>
......
...@@ -687,7 +687,7 @@ ...@@ -687,7 +687,7 @@
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
string:Base_viewListMode?proxy_form_id=${form/getId}&proxy_field_id=${field/getId} string:Base_viewListMode?proxy_form_id=${form/getId}&proxy_field_id=${field/getId}&proxy_field_selection_name=${field/selection_name}
]]></string> </value> ]]></string> </value>
</item> </item>
......
...@@ -611,7 +611,7 @@ ...@@ -611,7 +611,7 @@
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
string:Base_viewListMode?proxy_form_id=${form/getId}&proxy_field_id=${field/getId} string:Base_viewListMode?proxy_form_id=${form/getId}&proxy_field_id=${field/getId}&proxy_field_selection_name=${field/selection_name}
]]></string> </value> ]]></string> </value>
</item> </item>
......
...@@ -665,7 +665,7 @@ ...@@ -665,7 +665,7 @@
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
string:Base_viewListMode?proxy_form_id=${form/getId}&proxy_field_id=${field/getId} string:Base_viewListMode?proxy_form_id=${form/getId}&proxy_field_id=${field/getId}&proxy_field_selection_name=${field/selection_name}
]]></string> </value> ]]></string> </value>
</item> </item>
......
...@@ -528,7 +528,7 @@ ...@@ -528,7 +528,7 @@
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
string:Base_viewListMode?proxy_form_id=${form/getId}&proxy_field_id=${field/getId} string:Base_viewListMode?proxy_form_id=${form/getId}&proxy_field_id=${field/getId}&proxy_field_selection_name=${field/selection_name}
]]></string> </value> ]]></string> </value>
</item> </item>
......
...@@ -686,7 +686,7 @@ ...@@ -686,7 +686,7 @@
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
string:Base_viewListMode?proxy_form_id=${form/getId}&proxy_field_id=${field/getId} string:Base_viewListMode?proxy_form_id=${form/getId}&proxy_field_id=${field/getId}&proxy_field_selection_name=${field/selection_name}
]]></string> </value> ]]></string> </value>
</item> </item>
......
...@@ -754,7 +754,7 @@ ...@@ -754,7 +754,7 @@
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
string:Base_viewListMode?proxy_form_id=${form/getId}&proxy_field_id=${field/getId} string:Base_viewListMode?proxy_form_id=${form/getId}&proxy_field_id=${field/getId}&proxy_field_selection_name=${field/selection_name}
]]></string> </value> ]]></string> </value>
</item> </item>
......
...@@ -616,7 +616,7 @@ ...@@ -616,7 +616,7 @@
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
string:Base_viewListMode?proxy_form_id=${form/getId}&proxy_field_id=${field/getId} string:Base_viewListMode?proxy_form_id=${form/getId}&proxy_field_id=${field/getId}&proxy_field_selection_name=${field/selection_name}
]]></string> </value> ]]></string> </value>
</item> </item>
......
...@@ -597,7 +597,7 @@ ...@@ -597,7 +597,7 @@
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
string:Base_viewListMode?proxy_form_id=${form/getId}&proxy_field_id=${field/getId} string:Base_viewListMode?proxy_form_id=${form/getId}&proxy_field_id=${field/getId}&proxy_field_selection_name=${field/selection_name}
]]></string> </value> ]]></string> </value>
</item> </item>
......
...@@ -575,7 +575,7 @@ ...@@ -575,7 +575,7 @@
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
string:Base_viewListMode?proxy_form_id=${form/getId}&proxy_field_id=${field/getId} string:Base_viewListMode?proxy_form_id=${form/getId}&proxy_field_id=${field/getId}&proxy_field_selection_name=${field/selection_name}
]]></string> </value> ]]></string> </value>
</item> </item>
......
...@@ -342,7 +342,7 @@ ...@@ -342,7 +342,7 @@
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
string:Base_viewListMode?proxy_form_id=${form/getId}&proxy_field_id=${field/getId} string:Base_viewListMode?proxy_form_id=${form/getId}&proxy_field_id=${field/getId}&proxy_field_selection_name=${field/selection_name}
]]></string> </value> ]]></string> </value>
</item> </item>
......
...@@ -629,7 +629,7 @@ ...@@ -629,7 +629,7 @@
<!-- Test show listbox of a form in "view" mode -->\n <!-- Test show listbox of a form in "view" mode -->\n
<tr>\n <tr>\n
<td>open</td>\n <td>open</td>\n
<td>${base_url}/foo_module/0/Base_viewListMode?proxy_form_id=Foo_view&proxy_field_id=listbox</td>\n <td>${base_url}/foo_module/0/Base_viewListMode?proxy_form_id=Foo_view&proxy_field_id=listbox&proxy_field_selection_name=foo_line_selection</td>\n
<td></td>\n <td></td>\n
</tr>\n </tr>\n
<tr>\n <tr>\n
......
...@@ -568,7 +568,7 @@ ...@@ -568,7 +568,7 @@
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
string:Base_viewListMode?proxy_form_id=${form/getId}&proxy_field_id=${field/getId} string:Base_viewListMode?proxy_form_id=${form/getId}&proxy_field_id=${field/getId}&proxy_field_selection_name=${field/selection_name}
]]></string> </value> ]]></string> </value>
</item> </item>
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>selection_name = \'list_mode_proxy_selection\'\n <value> <string>selection_name = \'%s_list_mode_proxy_selection\' % proxy_field_selection_name\n
selection_tool = context.getPortalObject().portal_selections\n selection_tool = context.getPortalObject().portal_selections\n
\n \n
selection_tool.setSelectionParamsFor(selection_name,\n selection_tool.setSelectionParamsFor(selection_name,\n
...@@ -62,7 +62,7 @@ return context.Base_viewListModeRenderer(REQUEST=container.REQUEST)\n ...@@ -62,7 +62,7 @@ return context.Base_viewListModeRenderer(REQUEST=container.REQUEST)\n
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>proxy_form_id=\'\', proxy_field_id=\'listbox\'</string> </value> <value> <string>proxy_field_selection_name=\'\', proxy_form_id=\'\', proxy_field_id=\'listbox\'</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
...@@ -162,7 +162,7 @@ ...@@ -162,7 +162,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>request/proxy_field_id | python: context.portal_selections.getSelectionParamsFor(\'list_mode_proxy_selection\').get(\'proxy_field_id\', \'listbox\')</string> </value> <value> <string>request/proxy_field_id | python: context.portal_selections.getSelectionParamsFor(\'%s_list_mode_proxy_selection\' % context.REQUEST.get(\'selection_name\', \'\')).get(\'proxy_field_id\', \'listbox\')</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
...@@ -175,7 +175,7 @@ ...@@ -175,7 +175,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>request/proxy_form_id | python: context.portal_selections.getSelectionParamsFor(\'list_mode_proxy_selection\').get(\'proxy_form_id\', \'Folder_viewContentList\')</string> </value> <value> <string>request/proxy_form_id | python: context.portal_selections.getSelectionParamsFor(\'%s_list_mode_proxy_selection\' % context.REQUEST.get(\'selection_name\', \'\')).get(\'proxy_form_id\', \'Folder_viewContentList\')</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
...@@ -201,7 +201,7 @@ ...@@ -201,7 +201,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>request/proxy_form_id | python: context.portal_selections.getSelectionParamsFor(\'list_mode_proxy_selection\').get(\'proxy_form_id\', \'Folder_viewContentList\')</string> </value> <value> <string>request/proxy_form_id | python: context.portal_selections.getSelectionParamsFor(\'%s_list_mode_proxy_selection\' % context.REQUEST.get(\'selection_name\', \'\')).get(\'proxy_form_id\', \'Folder_viewContentList\')</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -65,17 +65,20 @@ if uids == []:\n ...@@ -65,17 +65,20 @@ if uids == []:\n
return request.RESPONSE.redirect( context.absolute_url() + \'/\' + form_id + qs )\n return request.RESPONSE.redirect( context.absolute_url() + \'/\' + form_id + qs )\n
\n \n
field_id=\'listbox\'\n field_id=\'listbox\'\n
field_selection_name=\'folder_delete_selection\'\n
# XXX If we come from the view mode -> list mode proxy, make sure we don\'t make\n # XXX If we come from the view mode -> list mode proxy, make sure we don\'t make\n
# another proxy to this proxy.\n # another proxy to this proxy.\n
if form_id == \'Base_viewListModeRenderer\':\n if form_id == \'Base_viewListModeRenderer\':\n
form_id = context.Base_viewListModeRenderer.listbox.get_value(\'form_id\')\n form_id = context.Base_viewListModeRenderer.listbox.get_value(\'form_id\')\n
field_id = context.Base_viewListModeRenderer.listbox.get_value(\'field_id\')\n field_id = context.Base_viewListModeRenderer.listbox.get_value(\'field_id\')\n
field_selection_name = context.Base_viewListModeRenderer.listbox.get_value(\'selection_name\')\n
\n \n
kw = {\'uid\': uids, \'form_id\': form_id, \'field_id\': field_id}\n kw = {\'uid\': uids, \'form_id\': form_id, \'field_id\': field_id}\n
request.set(\'object_uid\', context.getUid())\n request.set(\'object_uid\', context.getUid())\n
request.set(\'uids\', uids)\n request.set(\'uids\', uids)\n
request.set(\'proxy_form_id\', form_id)\n request.set(\'proxy_form_id\', form_id)\n
request.set(\'proxy_field_id\', field_id)\n request.set(\'proxy_field_id\', field_id)\n
request.set(\'proxy_field_selection_name\', field_selection_name)\n
request.set(\'ignore_hide_rows\', 1)\n request.set(\'ignore_hide_rows\', 1)\n
\n \n
context.portal_selections.setSelectionParamsFor(\'folder_delete_selection\', kw)\n context.portal_selections.setSelectionParamsFor(\'folder_delete_selection\', kw)\n
......
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