[FIX] fields: apply user timezone in display name for models using a datetime as name

For models using a datetime field as name (hr.attendance for instance), the user timezone wasn't applied in the display name.
Therefore, in the breadcrumb, the datetime was different than in the form if the user had another timezone than UTC.
This commit is contained in:
Denis Ledoux 2015-01-05 12:44:59 +01:00
parent d80c0ff647
commit 27d8cb843b
1 changed files with 5 additions and 0 deletions

View File

@ -367,6 +367,11 @@ class datetime(_column):
exc_info=True)
return utc_timestamp
@classmethod
def _as_display_name(cls, field, cr, uid, obj, value, context=None):
value = datetime.context_timestamp(cr, uid, DT.datetime.strptime(value, tools.DEFAULT_SERVER_DATETIME_FORMAT), context=context)
return tools.ustr(value.strftime(tools.DEFAULT_SERVER_DATETIME_FORMAT))
class binary(_column):
_type = 'binary'
_symbol_c = '%s'