[IMP] start date and end date can't be same, track must have secret key.

bzr revid: vme@tinyerp.com-20140313101559-q3h08sxbvuy3j7ov
This commit is contained in:
Vidhin Mehta (OpenERP) 2014-03-13 15:45:59 +05:30
parent 49c965aed1
commit 03ca05f638
2 changed files with 2 additions and 1 deletions

View File

@ -148,7 +148,7 @@ class website_event(http.Controller):
keys = unsort_tracks[track[2][:8]].keys()
secret_key = keys[index]
row_span = index
if value[1] == end_time:
if value[1] == end_time and secret_key:
if not index == row_span:
index = index + 1
event_tracks = event_track_obj.browse(request.cr, request.uid, track[0], context=request.context)

View File

@ -107,6 +107,7 @@ class event_track(osv.osv):
ids_to_compare = self.search(cr, uid, [("id","!=",track.id),('event_id', '=', track.event_id.id),('location_id', '=', track.location_id.id)])
start_time = datetime.datetime.strptime(track.date, '%Y-%m-%d %H:%M:%S')
end_time = start_time + datetime.timedelta(minutes = track.duration)
if end_time <= start_time:return False
for com_track in self.browse(cr, uid, ids_to_compare, context=context):
com_start_time = datetime.datetime.strptime(com_track.date, '%Y-%m-%d %H:%M:%S')
com_end_time = com_start_time + datetime.timedelta(minutes = com_track.duration)