From ba2689e70ce7456aac8cd2368408ad36731cb404 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Mon, 23 Dec 2013 00:00:21 +0100 Subject: [PATCH] [FIX] don't crash on empty dates [IMP] default dates on demo tracks bzr revid: fp@tinyerp.com-20131222230021-9a03x3eiwi4e780x --- addons/website/models/ir_qweb.py | 8 +++++--- addons/website_event_track/data/event_demo.xml | 6 +++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/addons/website/models/ir_qweb.py b/addons/website/models/ir_qweb.py index 32e6a8d33e8..aa7200c79b3 100644 --- a/addons/website/models/ir_qweb.py +++ b/addons/website/models/ir_qweb.py @@ -159,14 +159,16 @@ class DateTime(orm.AbstractModel): if isinstance(value, basestring): value = datetime.datetime.strptime( value, DEFAULT_SERVER_DATETIME_FORMAT) - value = column.context_timestamp( - cr, uid, timestamp=value, context=context) + if value: + value = column.context_timestamp( + cr, uid, timestamp=value, context=context) + value = value.strftime(openerp.tools.DEFAULT_SERVER_DATETIME_FORMAT) attrs = super(DateTime, self).attributes( cr, uid, field_name, record, options, source_element, g_att, t_att, qweb_context, context=None) return itertools.chain(attrs, [ - ('data-oe-original', value.strftime(openerp.tools.DEFAULT_SERVER_DATETIME_FORMAT)) + ('data-oe-original', value) ]) def from_html(self, cr, uid, model, column, element, context=None): diff --git a/addons/website_event_track/data/event_demo.xml b/addons/website_event_track/data/event_demo.xml index 92cf6db243c..69e4fbf590e 100644 --- a/addons/website_event_track/data/event_demo.xml +++ b/addons/website_event_track/data/event_demo.xml @@ -86,7 +86,7 @@ - + @@ -117,7 +117,7 @@ 1 - + @@ -164,7 +164,7 @@ 0 - +