diff --git a/addons/caldav/caldav_node.py b/addons/caldav/caldav_node.py index 700caafa0f0..c6e21c46e77 100644 --- a/addons/caldav/caldav_node.py +++ b/addons/caldav/caldav_node.py @@ -233,9 +233,21 @@ class node_calendar(nodes.node_class): Return the node_* created """ # we ignore the path, it will be re-generated automatically + fil_obj = self.context._dirobj.pool.get('basic.calendar') + ctx = self.context.context.copy() + ctx.update(self.dctx) + uid = self.context.uid + res = self.set_data(cr, data) - - # TODO: use the res to create at least one node + + if res and len(res): + # We arbitrarily construct only the first node of the data + # that have been imported. ICS may have had more elements, + # but only one node can be returned here. + assert isinstance(res[0], (int, long)) + fnodes = fil_obj.get_calendar_objects(cr, uid, [self.calendar_id], self, + domain=[('id','=',res[0])], context=ctx) + return fnodes[0] return None