From c4a023ecad2eabcbbaaf5b8f280b9f2a37eecb4e Mon Sep 17 00:00:00 2001 From: Renaud Le Gac <legac@cppm.in2p3.fr> Date: Sat, 15 Dec 2012 09:51:11 +0100 Subject: [PATCH] Modify to_gridfilter to deal with linkedcombobox. --- modules/plugin_dbui/converter.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/modules/plugin_dbui/converter.py b/modules/plugin_dbui/converter.py index 4e1ca50e..9ed65508 100644 --- a/modules/plugin_dbui/converter.py +++ b/modules/plugin_dbui/converter.py @@ -424,8 +424,13 @@ def to_gridFilter(table, **kwargs): # ignore composite field defined for form cfg = to_field(field, composite=False) - # remove default value - # make no sense in this context + # remove field constraints making no sense for a filter + if 'allowBlank' in cfg: + cfg["allowBlank"] = True + + if 'readOnly' in cfg: + cfg['readOnly'] = False + if 'value' in cfg: del cfg['value'] @@ -433,6 +438,10 @@ def to_gridFilter(table, **kwargs): if cfg['xtype'] == 'xtextarea': cfg['xtype'] = 'xtextfield' + # replace all linkedcombobox by combobox + if cfg['xtype'] == 'xlinkedcombobox': + cfg['xtype'] = 'xcombobox' + # empty text for combobox if cfg['xtype'] == 'xcombobox': cfg['emptyText']= T('select...') @@ -440,7 +449,7 @@ def to_gridFilter(table, **kwargs): # prepare the name for the where close [table.field] cfg['name'] = name - # store information to customize the filter + # store information to customise the filter cfg['filterComment'] = comment cfg['filterOperator'] = operator cfg['filterType'] = field.type -- GitLab