Skip to content

Commit

Permalink
Use time instance to format time widget in tree
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
cedk committed Dec 29, 2016
1 parent d64612f commit 153e14c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tryton/gui/window/view_form/view/list_gtk/widget.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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 ''

Expand Down

0 comments on commit 153e14c

Please sign in to comment.