From 153e14c90a7fccfad6c3b6cb3ceb404933357c8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 29 Dec 2016 13:45:03 +0100 Subject: [PATCH] Use time instance to format time widget in tree The value of a time widget can be a datetime instance. The changeset acffa8c5cf89 changed the strftime by datetime_strftime but it can not format time instance so the value must be converted into time and use strftime. issue5930 review33711002 (grafted from 54afc9d4eea99d82bff7d4196a7c9e885f764cb8) --- tryton/gui/window/view_form/view/list_gtk/widget.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tryton/gui/window/view_form/view/list_gtk/widget.py b/tryton/gui/window/view_form/view/list_gtk/widget.py index f0c7f81256..494c7420c5 100644 --- a/tryton/gui/window/view_form/view/list_gtk/widget.py +++ b/tryton/gui/window/view_form/view/list_gtk/widget.py @@ -1,6 +1,6 @@ # This file is part of Tryton. The COPYRIGHT file at the top level of # this repository contains the full copyright notices and license terms. - +import datetime import os import tempfile import gtk @@ -387,7 +387,9 @@ def get_textual_value(self, record): return '' value = record[self.attrs['name']].get_client(record) if value is not None: - return datetime_strftime(value, self.renderer.props.format) + if isinstance(value, datetime.datetime): + value = value.time() + return value.strftime(self.renderer.props.format) else: return ''