[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
This commit is contained in:
Nicolas Lempereur 2015-08-27 14:49:35 +02:00
parent e1d59f8f82
commit 898cae5684
1 changed files with 8 additions and 0 deletions

View File

@ -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 {})