[IMP] Add options hide_seconds in widget datetime. If this option is set with another value that False, seconds are removed from pattern to display only hours and minuts
bzr revid: jke@openerp.com-20140227164611-0tolnpzmaywhs15l
This commit is contained in:
@@ -611,6 +611,9 @@ class DateTimeConverter(osv.AbstractModel):
|
||||
strftime_pattern = (u"%s %s" % (lang.date_format, lang.time_format))
|
||||
pattern = openerp.tools.posix_to_ldml(strftime_pattern, locale=locale)
|
||||
|
||||
if options and options.get('hide_seconds'):
|
||||
pattern = pattern.replace(":ss", "").replace(":s", "")
|
||||
|
||||
return babel.dates.format_datetime(value, format=pattern, locale=locale)
|
||||
|
||||
class TextConverter(osv.AbstractModel):
|
||||
|
||||
Reference in New Issue
Block a user