diff --git a/tryton/gui/window/view_form/model/field.py b/tryton/gui/window/view_form/model/field.py index 18437516a2..e260c7533c 100644 --- a/tryton/gui/window/view_form/model/field.py +++ b/tryton/gui/window/view_form/model/field.py @@ -122,6 +122,13 @@ class DateTimeField(CharField): return value and str(value) or False +class DateField(CharField): + + def get_client(self, model): + value = super(DateField, self).get_client(model) + return value and str(value) or False + + class FloatField(CharField): def validate(self, model): @@ -388,4 +395,5 @@ TYPES = { 'selection': SelectionField, 'boolean': IntegerField, 'datetime': DateTimeField, + 'date': DateField, } diff --git a/tryton/gui/window/view_form/view/form_gtk/calendar.py b/tryton/gui/window/view_form/view/form_gtk/calendar.py index 197bb5ddff..b6599638f0 100644 --- a/tryton/gui/window/view_form/view/form_gtk/calendar.py +++ b/tryton/gui/window/view_form/view/form_gtk/calendar.py @@ -76,7 +76,7 @@ class Calendar(WidgetInterface): self.entry.set_text('') return False super(Calendar, self).display(model, model_field) - value = model_field.get(model) + value = model_field.get_client(model) if not value: self.entry.set_text('') else: diff --git a/tryton/pysocket.py b/tryton/pysocket.py index 32f8754d9e..96170ba77a 100644 --- a/tryton/pysocket.py +++ b/tryton/pysocket.py @@ -4,7 +4,7 @@ import cStringIO DNS_CACHE = {} -_ALLOWED_MODULES = {'datetime': ['datetime'], 'decimal': ['Decimal']} +_ALLOWED_MODULES = {'datetime': ['datetime', 'date'], 'decimal': ['Decimal']} def checkfunction(module, klass): if module in _ALLOWED_MODULES and klass in _ALLOWED_MODULES[module]: