Commit cc177837 authored by Romain Courteaud's avatar Romain Courteaud

[erp5_hal_json_style] Do not raise on unknown column for listbox

See http://git.erp5.org/gitweb/erp5.git/commitdiff/c6d26af5b6d9a35ab5062834f979043a5119dfc1?js=1#patch5
parent c47415d4
......@@ -363,6 +363,7 @@ def renderField(traversed_document, field, form_relative_url, value=None, meta_t
# portal_types = [x[1] for x in field.get_value(\'portal_types\')]\n
portal_types = field.get_value(\'portal_types\')\n
default_params = dict(field.get_value(\'default_params\'))\n
default_params[\'ignore_unknown_columns\'] = True\n
# How to implement pagination?\n
# default_params.update(REQUEST.form)\n
lines = field.get_value(\'lines\')\n
......
......@@ -540,6 +540,24 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin):
self.assertEqual(result_dict['_embedded']['_view']['my_id']['type'], 'StringField')
self.assertEqual(result_dict['_embedded']['_view']['my_id']['title'], 'ID')
self.assertSameSet(result_dict['_embedded']['_view']['listbox']['default_params'].keys(), ['ignore_unknown_columns'])
self.assertTrue(result_dict['_embedded']['_view']['listbox']['default_params']['ignore_unknown_columns'])
self.assertEqual(result_dict['_embedded']['_view']['listbox']['type'], 'ListBox')
self.assertEqual(result_dict['_embedded']['_view']['listbox']['key'], 'field_listbox')
self.assertEqual(result_dict['_embedded']['_view']['listbox']['title'], 'Foo Lines')
self.assertEqual(result_dict['_embedded']['_view']['listbox']['lines'], 3)
self.assertEqual(result_dict['_embedded']['_view']['listbox']['editable'], 1)
self.assertEqual(result_dict['_embedded']['_view']['listbox']['show_anchor'], 0)
self.assertEqual(result_dict['_embedded']['_view']['listbox']['list_method'], 'objectValues')
self.assertEqual(result_dict['_embedded']['_view']['listbox']['query'], 'urn:jio:allDocs?query=')
self.assertEqual(result_dict['_embedded']['_view']['listbox']['portal_type'], [['Foo Line', 'Foo Line']])
self.assertEqual(result_dict['_embedded']['_view']['listbox']['column_list'], [['id', 'ID'], ['title', 'Title'], ['quantity', 'Quantity'], ['start_date', 'Date']])
self.assertEqual(result_dict['_embedded']['_view']['listbox']['search_column_list'], [['id', 'ID'], ['title', 'Title'], ['quantity', 'Quantity'], ['start_date', 'Date']])
self.assertEqual(result_dict['_embedded']['_view']['listbox']['editable_column_list'], [['id', 'ID'], ['title', 'Title'], ['quantity', 'quantity'], ['start_date', 'Date']])
self.assertEqual(result_dict['_embedded']['_view']['listbox']['sort_column_list'], [['id', 'ID'], ['title', 'Title'], ['quantity', 'Quantity'], ['start_date', 'Date']])
self.assertEqual(result_dict['_embedded']['_view']['listbox']['list_method_template'],
'%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=search&relative_url=foo_module%%2F%s&form_relative_url=portal_skins/erp5_ui_test/Foo_view/listbox&list_method=objectValues&default_param_json=eyJwb3J0YWxfdHlwZSI6IFsiRm9vIExpbmUiXSwgImlnbm9yZV91bmtub3duX2NvbHVtbnMiOiB0cnVlfQ=={&query,select_list*,limit*,sort_on*,local_roles*}' % (self.portal.absolute_url(), document.getId()))
self.assertEqual(result_dict['_embedded']['_view']['_links']['traversed_document']['href'], 'urn:jio:get:%s' % document.getRelativeUrl())
self.assertEqual(result_dict['_embedded']['_view']['_links']['traversed_document']['name'], document.getRelativeUrl())
self.assertEqual(result_dict['_embedded']['_view']['_links']['traversed_document']['title'], document.getTitle().decode("UTF-8"))
......
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