CalDAV wizards: Set the uid in the context, just like the nodes would do.
[odoo/odoo.git] / addons / caldav / wizard / calendar_event_subscribe.py
index aa53993..f8dc761 100644 (file)
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 ##############################################################################
-#    
+#
 #    OpenERP, Open Source Management Solution
 #    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
 #
@@ -15,7 +15,7 @@
 #    GNU Affero General Public License for more details.
 #
 #    You should have received a copy of the GNU Affero General Public License
-#    along with this program.  If not, see <http://www.gnu.org/licenses/>.     
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 ##############################################################################
 
@@ -34,7 +34,8 @@ class calendar_event_subscribe(osv.osv_memory):
     Subscribe  Calendar Event.
     """
     cnt = 0
-    def _process_imp_ics(self, cr, uid, ids, context=None):
+
+    def process_imp_ics(self, cr, uid, ids, context=None):
         """
         process ics file.
         @param cr: the current row, from the database cursor,
@@ -43,6 +44,12 @@ class calendar_event_subscribe(osv.osv_memory):
         @return: dictionary of calendar evet subscribe  window with Import successful msg.
         """
         global cnt
+        if context is None:
+            context = {}
+        else:
+            context = context.copy()
+        context['uid'] = uid
+
         for data in self.read(cr, uid, ids):
             try:
                 f =  urllib.urlopen(data['url_path'])
@@ -62,7 +69,7 @@ class calendar_event_subscribe(osv.osv_memory):
             id2 = data_obj._get_id(cr, uid, 'caldav', 'view_calendar_event_subscribe_display')
             if id2:
                  id2 = data_obj.browse(cr, uid, id2, context=context).res_id
-          
+
             value = {
                 'view_type': 'form',
                 'view_mode': 'form',
@@ -72,18 +79,19 @@ class calendar_event_subscribe(osv.osv_memory):
                 'target': 'new'
             }
             return value
-    
+
     _name = "calendar.event.subscribe"
     _description = "Event subscribe"
+
     _columns = {
                 'url_path': fields.char('Provide path for remote calendar', size=124, required=True),
                 'msg': fields.text('', readonly=True),
+
                }
-    _defaults={
+    _defaults = {
                'msg':lambda *a:'Import Sucessful.'
                }
-    
-calendar_event_subscribe()
 
+calendar_event_subscribe()
 
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: