diff --git a/product/ERP5Form/Form.py b/product/ERP5Form/Form.py index d949b58d211887bf796bd14e7e1d4757f4f48380..eb1fa238fb520a1ec001ecfc1f5759d279f74872 100644 --- a/product/ERP5Form/Form.py +++ b/product/ERP5Form/Form.py @@ -142,12 +142,11 @@ def get_value(self, id, **kw): #value=value() # Mising call ??? XXX Make sure compatible with listbox methods if id == 'default': - if self.meta_type != 'DateTimeField': - # We make sure we convert values to empty strings - # for most fields (so that we do not get a 'value' - # message on screeen) - # This can be overriden by useing TALES in the field - if value is None: value = '' + # We make sure we convert values to empty strings + # for most fields (so that we do not get a 'value' + # message on screen) + # This can be overriden by using TALES in the field + if value is None: value = '' return value diff --git a/product/ERP5Form/FormulatorPatch.py b/product/ERP5Form/FormulatorPatch.py index 884321885c707aad3ab6cba95603054310e50ed3..367c32a6738dbb68eefef813aee26119b2ee04b2 100644 --- a/product/ERP5Form/FormulatorPatch.py +++ b/product/ERP5Form/FormulatorPatch.py @@ -806,7 +806,10 @@ class PatchedDateTimeWidget(DateTimeWidget): return date_result def format_value(self, field, value, mode='html'): - if value is None: + # Is it still usefull to test the None value, + # as DateTimeField should be considerer as the other field + # and get an empty string as default value? + if value in (None, ''): return '' use_ampm = field.get_value('ampm_time_style') @@ -1121,6 +1124,7 @@ def Field_render_htmlgrid(self, value=None, REQUEST=None, key=None): value = self._get_default(widget_key, value, REQUEST) __traceback_info__ = ('key=%s value=%r' % (key, value)) return self.widget.render_htmlgrid(self, widget_key, value, REQUEST) + Field.render_htmlgrid = Field_render_htmlgrid def Widget_render_htmlgrid(self, field, key, value, REQUEST):