[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:
Kersten Jeremy
2014-02-27 17:46:11 +01:00
parent 3e2c1b1be3
commit 7917c495e9
+3
View File
@@ -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):