From 223bb5234bc333574615ab890b4657c1d0d2374b Mon Sep 17 00:00:00 2001 From: "Bhumika (OpenERP)" Date: Fri, 8 Apr 2011 14:21:33 +0530 Subject: [PATCH] [Fix] sync_google_calendar: Improve code bzr revid: sbh@tinyerp.com-20110408085133-u13rpg549206w027 --- addons/sync_google_calendar/sync_google_calendar.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/addons/sync_google_calendar/sync_google_calendar.py b/addons/sync_google_calendar/sync_google_calendar.py index 12802831be0..1f654286e8c 100644 --- a/addons/sync_google_calendar/sync_google_calendar.py +++ b/addons/sync_google_calendar/sync_google_calendar.py @@ -20,17 +20,16 @@ ############################################################################## from osv import osv, fields -import base from base_calendar import base_calendar + class crm_meeting(osv.osv): _inherit = "crm.meeting" def unlink(self, cr, uid, ids, context=None): model_obj = self.pool.get('ir.model.data') - for meeting_id in ids: - id=base_calendar.base_calendar_id2real_id(meeting_id) - model_ids = model_obj.search(cr, uid, [('res_id','in',[id]),('model','=','crm.meeting'),('module','=','sync_google_calendar')], context=context) - model_obj.unlink(cr, uid, model_ids, context=context) + ids = map(lambda x: base_calendar.base_calendar_id2real_id(x), ids) + model_ids = model_obj.search(cr, uid, [('res_id','in',ids),('model','=','crm.meeting'),('module','=','sync_google_calendar')], context=context) + model_obj.unlink(cr, uid, model_ids, context=context) return super(crm_meeting, self).unlink(cr, uid, ids, context=context) crm_meeting()