[FIX] base: ir_qweb fix timezone for datetime with widget=date

Before this commit, display a datetime field with the widget="date" was ignoring
the timezone.

This commit closes #24761
This commit is contained in:
Carlos Dauden
2018-06-12 15:48:21 +02:00
committed by Jeremy Kersten
parent ce6b6e6458
commit ac68eb5b3d
+5 -1
View File
@@ -173,7 +173,11 @@ class DateConverter(models.AbstractModel):
locale = babel.Locale.parse(lang.code)
if isinstance(value, basestring):
value = fields.Datetime.from_string(value[:10])
if len(value) > 10: # datetime to be displayed as date
value = fields.Datetime.from_string(value)
value = fields.Datetime.context_timestamp(self, value)
else:
value = fields.Datetime.from_string(value)
if options and 'format' in options:
pattern = options['format']