From c02f16e4438dde693de803d3aa316fcfdefcce73 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Thu, 16 Jan 2014 10:47:58 +0100 Subject: [PATCH] [FIX] base_calendar: when searching on events, avoid getting an error if virtual_id=False and count=True bzr revid: mat@openerp.com-20140116094758-y32i7bw4zpakk92z --- addons/base_calendar/base_calendar.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py index 20fcb323b5d..cfec9fbfe10 100644 --- a/addons/base_calendar/base_calendar.py +++ b/addons/base_calendar/base_calendar.py @@ -1413,12 +1413,12 @@ rule or repeating pattern of time to exclude from the recurring rule."), new_id = get_real_ids(arg[2]) new_arg = (arg[0], arg[1], new_id) new_args.append(new_arg) - if context.get('virtual_id', True): - #offset, limit, order and count must be treated separately as we may need to deal with virtual ids - res = super(calendar_event, self).search(cr, uid, new_args, offset=0, limit=0, order=None, context=context, count=False) - res = self._get_recurrent_ids(cr, uid, res, args, limit, order=order, context=context) - else: - res = super(calendar_event, self).search(cr, uid, new_args, offset=offset, limit=limit, order=order, context=context, count=count) + if not context.get('virtual_id', True): + return super(calendar_event, self).search(cr, uid, new_args, offset=offset, limit=limit, order=order, context=context, count=count) + + # offset, limit, order and count must be treated separately as we may need to deal with virtual ids + res = super(calendar_event, self).search(cr, uid, new_args, offset=0, limit=0, order=None, context=context, count=False) + res = self._get_recurrent_ids(cr, uid, res, args, limit, order=order, context=context) if count: return len(res)