diff --git a/product/ERP5Form/ListBox.py b/product/ERP5Form/ListBox.py index 5d59bc204665e30302b78a1db9d274da438884ec..491cec0c7d197fa07a0f4abbe4079e0c01a508b0 100644 --- a/product/ERP5Form/ListBox.py +++ b/product/ERP5Form/ListBox.py @@ -2616,6 +2616,12 @@ class ListBoxHTMLRenderer(ListBoxRenderer): selection.edit(method_path = method_path, list_url = list_url) self.getSelectionTool().setSelectionFor(self.getSelectionName(), selection, REQUEST = self.request) + # do pass current form and respective field through request + request = self.request + field_id = self.getId() + form = self.getForm() + request.set('form_id', form.getId()) + request.set('field_id', field_id) pt = self.getPageTemplate() return pt() diff --git a/product/ERP5Form/tests/testListBox.py b/product/ERP5Form/tests/testListBox.py index 4c18a817820094bf84264b13218e5d71faf0dc11..106c638e9c090fb95276312c69dbeaee3f230478 100644 --- a/product/ERP5Form/tests/testListBox.py +++ b/product/ERP5Form/tests/testListBox.py @@ -622,6 +622,20 @@ return [] self.assertSameSet([('id', u'ID'), ('title', u'Title'), ('getQuantity', u'Quantity')], getListBoxRenderer(listbox).getSelectedColumnList()) + def test_ListboxRequestParameterPropagandation(self): + """ + Test that rendering a listbox field will set respective form & field_id of current form + in REQUEST for further usage by used by litsbox's columns methods. + """ + portal = self.getPortal() + request = get_request() + portal.ListBoxZuite_reset() + form = portal.FooModule_viewFooList + self.assertEqual(None, request.get('form_id')) + form.render() + self.assertEqual(form.getId(), request.get('form_id')) + self.assertEqual(form.listbox.getId(), request.get('field_id')) + def test_suite(): suite = unittest.TestSuite()