Skip to content

Commit

Permalink
[IMP] ir_qweb: remove the option 'only_date' introducted in cefc9ad. …
Browse files Browse the repository at this point in the history
…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'}"/>
  • Loading branch information
JKE-be committed Oct 10, 2014
1 parent b576de5 commit fc47823
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions openerp/addons/base/ir/ir_qweb.py
Original file line number Diff line number Diff line change
Expand Up @@ -675,13 +675,13 @@ class DateConverter(osv.AbstractModel):
_inherit = 'ir.qweb.field'

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)
locale = babel.Locale.parse(lang.code)

if isinstance(value, basestring):
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:
pattern = options['format']
Expand Down Expand Up @@ -711,10 +711,7 @@ def value_to_html(self, cr, uid, value, column, options=None, context=None):
if options and 'format' in options:
pattern = options['format']
else:
if options and options.get('only_date') and options.get('only_date') in ["True", 'true']:
strftime_pattern = (u"%s" % (lang.date_format))
else:
strftime_pattern = (u"%s %s" % (lang.date_format, lang.time_format))
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'):
Expand Down

0 comments on commit fc47823

Please sign in to comment.