Commit f6a79a1a 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 6cf2d34d
......@@ -607,7 +607,7 @@
<key> <string>_text</string> </key>
<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>
</item>
......
......@@ -687,7 +687,7 @@
<key> <string>_text</string> </key>
<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>
</item>
......
......@@ -611,7 +611,7 @@
<key> <string>_text</string> </key>
<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>
</item>
......
......@@ -665,7 +665,7 @@
<key> <string>_text</string> </key>
<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>
</item>
......
......@@ -528,7 +528,7 @@
<key> <string>_text</string> </key>
<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>
</item>
......
......@@ -686,7 +686,7 @@
<key> <string>_text</string> </key>
<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>
</item>
......
......@@ -754,7 +754,7 @@
<key> <string>_text</string> </key>
<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>
</item>
......
......@@ -616,7 +616,7 @@
<key> <string>_text</string> </key>
<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>
</item>
......
......@@ -597,7 +597,7 @@
<key> <string>_text</string> </key>
<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>
</item>
......
......@@ -575,7 +575,7 @@
<key> <string>_text</string> </key>
<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>
</item>
......
......@@ -342,7 +342,7 @@
<key> <string>_text</string> </key>
<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>
</item>
......
......@@ -629,7 +629,7 @@
<!-- Test show listbox of a form in "view" mode -->\n
<tr>\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
</tr>\n
<tr>\n
......
......@@ -568,7 +568,7 @@
<key> <string>_text</string> </key>
<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>
</item>
......
......@@ -50,7 +50,7 @@
</item>
<item>
<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
\n
selection_tool.setSelectionParamsFor(selection_name,\n
......@@ -62,7 +62,7 @@ return context.Base_viewListModeRenderer(REQUEST=container.REQUEST)\n
</item>
<item>
<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>
<key> <string>id</string> </key>
......
......@@ -162,7 +162,7 @@
<dictionary>
<item>
<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>
</dictionary>
</pickle>
......@@ -175,7 +175,7 @@
<dictionary>
<item>
<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>
  • I logged the call of getSelectionParamsFor... after clicking on the next page button I got:

    selection_name: Person_viewAssignment_listbox_selection_list_mode_proxy_selection
    returned params: {'proxy_field_id': 'listbox', 'proxy_form_id': 'Person_viewAssignment', 'ignore_unknown_columns': True}
    selection_name: Person_viewAssignment_listbox_selection_list_mode_proxy_selection
    returned params: {'proxy_field_id': 'listbox', 'proxy_form_id': 'Person_viewAssignment', 'ignore_unknown_columns': True}
    selection_name: Person_viewAssignment_listbox_selection_list_mode_proxy_selection
    returned params: {'proxy_field_id': 'listbox', 'proxy_form_id': 'Person_viewAssignment', 'ignore_unknown_columns': True}
    selection_name: Person_viewAssignment_listbox_selection_list_mode_proxy_selection
    returned params: {'proxy_field_id': 'listbox', 'proxy_form_id': 'Person_viewAssignment', 'ignore_unknown_columns': True}
    selection_name: Base_viewListModeRenderer_listbox_selection_list_mode_proxy_selection
    returned params: {}
    selection_name: Base_viewListModeRenderer_listbox_selection_list_mode_proxy_selection
    returned params: {}
    selection_name: Base_viewListModeRenderer_listbox_selection_list_mode_proxy_selection
    returned params: {}
    ...x100 or more

    If I change the value like below, I get the output I want.

    -request/proxy_field_id | python: context.portal_selections.getSelectionParamsFor(\'%s_list_mode_proxy_selection\' % context.REQUEST.get(\'selection_name\', \'\')).get(\'proxy_field_id\', \'listbox\')
    +request/proxy_field_id | python: "listbox"
     [...]
    -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\')
    +request/proxy_form_id | python: "Person_viewAssignment"

    Everything seems to be fine for me... but still not working.

    The "...x100 or more" is pretty curious for me. I need to investigate more. Do you have an idea @arnau ?

Please register or sign in to reply
</item>
</dictionary>
</pickle>
......@@ -201,7 +201,7 @@
<dictionary>
<item>
<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>
</dictionary>
</pickle>
......
......@@ -65,17 +65,20 @@ if uids == []:\n
return request.RESPONSE.redirect( context.absolute_url() + \'/\' + form_id + qs )\n
\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
# another proxy to this proxy.\n
if form_id == \'Base_viewListModeRenderer\':\n
form_id = context.Base_viewListModeRenderer.listbox.get_value(\'form_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
kw = {\'uid\': uids, \'form_id\': form_id, \'field_id\': field_id}\n
request.set(\'object_uid\', context.getUid())\n
request.set(\'uids\', uids)\n
request.set(\'proxy_form_id\', form_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
\n
context.portal_selections.setSelectionParamsFor(\'folder_delete_selection\', kw)\n
......
  • This commit make a new bug in erp5.

    How to reproduce:

    go to a person > go to assignments tab > click on assignment list title > click on next page ... nothing appears ...

    It seems that proxy_form_id, proxy_field_id and proxy_selection_name are not sent by clicking on next page.

  • I fixed it by setting selection name in tales:

    python: '%s_%s_selection' % (
      request.get("proxy_form_id") or
      context.portal_selections.getSelectionParamsFor('%s_list_mode_proxy_selection' % context.REQUEST.get('selection_name', '')).get('proxy_form_id', 'Folder_viewContentList'),
      request.get("proxy_field_id") or
      context.portal_selections.getSelectionParamsFor('%s_list_mode_proxy_selection' % context.REQUEST.get('selection_name', '')).get('proxy_field_id', 'listbox')
    )

    I need to add a test now

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