From 3ce0e12b87d3096f035c1963463f263a73760e61 Mon Sep 17 00:00:00 2001 From: Omar Date: Wed, 12 Oct 2011 20:16:15 +0200 Subject: [PATCH] [IMP] base_calendar: Great speed improvement reading events on base_calendar bzr revid: omar@pexego.es-20111012181615-fkz3pq7mhey7bwvb --- addons/base_calendar/base_calendar.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py index 18f267a1df1..30323cae6bc 100644 --- a/addons/base_calendar/base_calendar.py +++ b/addons/base_calendar/base_calendar.py @@ -1396,13 +1396,14 @@ rule or repeating pattern of time to exclude from the recurring rule."), if fields and 'duration' not in fields: fields.append('duration') + real_data = {} + real_data = super(calendar_event, self).read(cr, uid, + [real_id for base_calendar_id, real_id in select], + fields=fields, context=context, load=load) + real_data = dict(zip([x['id'] for x in real_data], real_data)) for base_calendar_id, real_id in select: - #REVET: Revision ID: olt@tinyerp.com-20100924131709-cqsd1ut234ni6txn - res = super(calendar_event, self).read(cr, uid, real_id, fields=fields, context=context, load=load) - - if not res : - continue + res = real_data[real_id].copy() ls = base_calendar_id2real_id(base_calendar_id, with_date=res and res.get('duration', 0) or 0) if not isinstance(ls, (str, int, long)) and len(ls) >= 2: res['date'] = ls[1]