From 898cae56841f73a6cd84ec080b2aae708e0d21e7 Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Thu, 27 Aug 2015 14:49:35 +0200 Subject: [PATCH] [FIX] calendar: manage export of recurring event When we export a recurring event, there was an error since there is virtual ids (like '{real_id}-{date_of_the_event}'). Events steming from a recurring events are in fact shown virtually. In the database there is really only one event and a suffix is appended to the id to target a given instance of a recurring event. If we want to separate a recurring event from the instances, we can edit the instance and use the link "Update only this instance", once done this instance is separated for the recurring event. This commit if one or more recurring events instances are selected when an export is done, will only export one source event of each of the events occurences. fixes #7932 closes #8262 opw-647676 --- addons/calendar/calendar.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/addons/calendar/calendar.py b/addons/calendar/calendar.py index 8ccf6639f86..21e530e8020 100644 --- a/addons/calendar/calendar.py +++ b/addons/calendar/calendar.py @@ -1654,6 +1654,14 @@ class calendar_event(osv.Model): self.create_attendees(cr, uid, [res], context=context) return res + def export_data(self, cr, uid, ids, *args, **kwargs): + """ Override to convert virtual ids to ids """ + real_ids = [] + for real_id in get_real_ids(ids): + if real_id not in real_ids: + real_ids.append(real_id) + return super(calendar_event, self).export_data(cr, uid, real_ids, *args, **kwargs) + def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None, orderby=False, lazy=True): context = dict(context or {})