From c2fee9e69119addd84897005f4eb3ce7ad34a732 Mon Sep 17 00:00:00 2001 From: "P. Christeas" Date: Thu, 12 Aug 2010 14:10:28 +0300 Subject: [PATCH] caldav: when creating a calendar child, return a node bzr revid: p_christ@hol.gr-20100812111028-tntn2b1uspc64cyd --- addons/caldav/caldav_node.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) 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