[MERGE] merge with latest stable
[odoo/odoo.git] / addons / caldav / calendar_collection.py
index 851f7ae..1258ba5 100644 (file)
@@ -35,12 +35,16 @@ class calendar_collection(osv.osv):
     }
     
     def _get_root_calendar_directory(self, cr, uid, context=None):
-        data_pool = self.pool.get('ir.model.data')
+        objid = self.pool.get('ir.model.data')
         try:
-            calendar_dir_id = data_pool.get_object(cr, uid, 'caldav', 'document_directory_calendars0')
-            return calendar_dir_id.name
+            mid = objid._get_id(cr, uid, 'document', 'dir_calendars')
+            if not mid:
+                return False
+            root_id = objid.read(cr, uid, mid, ['res_id'])['res_id']
+            root_cal_dir = self.browse(cr,uid, root_id, context=context) 
+            return root_cal_dir.name
         except Exception:
-            logger = logging.getLogger('caldav')
+            logger = logging.getLogger('document')
             logger.warning('Cannot set root directory for Calendars:', exc_info=True)
             return False
         return False
@@ -61,8 +65,6 @@ class calendar_collection(osv.osv):
 
     def get_description(self, cr, uid, ids, context=None):
         #TODO : return description of all calendars
-        if not context:
-            context = {}
         return False
 
     def get_schedule_inbox_URL(self, cr, uid, ids, context=None):