[IMP] ir_qweb: remove the option 'only_date' introducted in cefc9ad8e3
. Now we can use widget='date' to do the same thing. That keeps the same behaviour that in the backend.
<span t-field=model.datetime_field t-field-options="{'widget': 'date'}"/>
This commit is contained in:
parent
b576de5f05
commit
fc47823ab2
|
@ -675,13 +675,13 @@ class DateConverter(osv.AbstractModel):
|
||||||
_inherit = 'ir.qweb.field'
|
_inherit = 'ir.qweb.field'
|
||||||
|
|
||||||
def value_to_html(self, cr, uid, value, column, options=None, context=None):
|
def value_to_html(self, cr, uid, value, column, options=None, context=None):
|
||||||
if not value: return ''
|
if not value or len(value)<10: return ''
|
||||||
lang = self.user_lang(cr, uid, context=context)
|
lang = self.user_lang(cr, uid, context=context)
|
||||||
locale = babel.Locale.parse(lang.code)
|
locale = babel.Locale.parse(lang.code)
|
||||||
|
|
||||||
if isinstance(value, basestring):
|
if isinstance(value, basestring):
|
||||||
value = datetime.datetime.strptime(
|
value = datetime.datetime.strptime(
|
||||||
value, openerp.tools.DEFAULT_SERVER_DATE_FORMAT)
|
value[:10], openerp.tools.DEFAULT_SERVER_DATE_FORMAT)
|
||||||
|
|
||||||
if options and 'format' in options:
|
if options and 'format' in options:
|
||||||
pattern = options['format']
|
pattern = options['format']
|
||||||
|
@ -711,10 +711,7 @@ class DateTimeConverter(osv.AbstractModel):
|
||||||
if options and 'format' in options:
|
if options and 'format' in options:
|
||||||
pattern = options['format']
|
pattern = options['format']
|
||||||
else:
|
else:
|
||||||
if options and options.get('only_date') and options.get('only_date') in ["True", 'true']:
|
strftime_pattern = (u"%s %s" % (lang.date_format, lang.time_format))
|
||||||
strftime_pattern = (u"%s" % (lang.date_format))
|
|
||||||
else:
|
|
||||||
strftime_pattern = (u"%s %s" % (lang.date_format, lang.time_format))
|
|
||||||
pattern = openerp.tools.posix_to_ldml(strftime_pattern, locale=locale)
|
pattern = openerp.tools.posix_to_ldml(strftime_pattern, locale=locale)
|
||||||
|
|
||||||
if options and options.get('hide_seconds'):
|
if options and options.get('hide_seconds'):
|
||||||
|
|
Loading…
Reference in New Issue