[IMP] ir_qweb: remove the option 'only_date' introducted in cefc9ad8e3e3b0a14804da6c4...
authorJeremy Kersten <jke@odoo.com>
Fri, 10 Oct 2014 14:20:10 +0000 (16:20 +0200)
committerJeremy Kersten <jke@odoo.com>
Fri, 10 Oct 2014 14:20:10 +0000 (16:20 +0200)
    <span t-field=model.datetime_field t-field-options="{'widget': 'date'}"/>

openerp/addons/base/ir/ir_qweb.py

index 9c90cf4..6a54e6f 100644 (file)
@@ -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']
@@ -711,10 +711,7 @@ class DateTimeConverter(osv.AbstractModel):
         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'):