Browse Source

Fix problem with recurrent events - they change the type of id which causes an error retrieving the id

pull/392/head
Danimar Ribeiro 9 years ago
parent
commit
56147496de
  1. 8
      super_calendar/models/super_calendar_configurator.py

8
super_calendar/models/super_calendar_configurator.py

@ -163,13 +163,19 @@ class SuperCalendarConfigurator(models.Model):
tools.DEFAULT_SERVER_DATETIME_FORMAT tools.DEFAULT_SERVER_DATETIME_FORMAT
) )
# Recurrent events have an string id like '14-20151110120000'
# We need to split that to get the first part (id)
if isinstance(cur_rec['id'], basestring):
rec_id = cur_rec['id'].split('-')[0]
else:
rec_id = cur_rec['id']
super_calendar_values = { super_calendar_values = {
'name': name, 'name': name,
'date_start': date_start, 'date_start': date_start,
'duration': duration, 'duration': duration,
'user_id': (f_user and cur_rec[f_user].id), 'user_id': (f_user and cur_rec[f_user].id),
'configurator_id': self.id, 'configurator_id': self.id,
'res_id': line.name.model + ',' + str(cur_rec['id']),
'res_id': line.name.model + ',' + str(rec_id),
'model_id': line.name.id, 'model_id': line.name.id,
} }
res[cur_rec] = super_calendar_values res[cur_rec] = super_calendar_values

Loading…
Cancel
Save