[FIX] base_calendar: improve the code

bzr revid: kjo@tinyerp.com-20111223110114-66tiz3fbv6j3iqlp
This commit is contained in:
Kuldeep Joshi (OpenERP) 2011-12-23 16:31:14 +05:30
parent 0cc45c9454
commit 2a954a8c90
1 changed files with 3 additions and 2 deletions

View File

@ -1486,6 +1486,7 @@ rule or repeating pattern of time to exclude from the recurring rule."),
if not isinstance(ids, list):
ids = [ids]
res = False
calendar_obj=self.pool.get('calendar.attendee')
for event_id in ids[:]:
if len(str(event_id).split('-')) == 1:
continue
@ -1500,8 +1501,8 @@ rule or repeating pattern of time to exclude from the recurring rule."),
ids.remove(event_id)
for event in self.browse(cr, uid, ids, context=context):
if event.attendee_ids:
for attendee in event.attendee_ids:
self.pool.get('calendar.attendee').unlink(cr, uid, attendee.id, context=context)
attendee_ids = [x.id for x in event.attendee_ids]
calendar_obj.unlink(cr, uid, attendee_ids, context=context)
res = super(calendar_event, self).unlink(cr, uid, ids, context=context)
self.pool.get('res.alarm').do_alarm_unlink(cr, uid, ids, self._name)