From bee0d0e6b570feef5ddd31e8325f01e99ae820d0 Mon Sep 17 00:00:00 2001 From: "sbh (Open ERP)" Date: Tue, 19 Jan 2010 19:28:57 +0530 Subject: [PATCH] [Fix] CRM: if date_deadline is exists then calcuatle the duration bzr revid: sbh@tinyerp.com-20100119135857-jzet3e1vkz0xupbj --- addons/crm/crm_meeting.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/addons/crm/crm_meeting.py b/addons/crm/crm_meeting.py index c1f4cbf995a..7c14b27f1e7 100644 --- a/addons/crm/crm_meeting.py +++ b/addons/crm/crm_meeting.py @@ -72,10 +72,11 @@ class crm_meeting(osv.osv): res = {} for meeting in self.browse(cr, uid, ids, context=context): start = datetime.strptime(meeting.date, "%Y-%m-%d %H:%M:%S") - end = datetime.strptime(meeting.date_deadline[:19], "%Y-%m-%d %H:%M:%S") - diff = end - start - duration = float(diff.days)* 24 + (float(diff.seconds) / 3600) - res[meeting.id] = round(duration, 2) + if meeting.date_deadline: + end = datetime.strptime(meeting.date_deadline[:19], "%Y-%m-%d %H:%M:%S") + diff = end - start + duration = float(diff.days)* 24 + (float(diff.seconds) / 3600) + res[meeting.id] = round(duration, 2) return res def _set_duration(self, cr, uid, id, name, value, arg, context):