diff --git a/addons/caldav/__init__.py b/addons/caldav/__init__.py index 19f11301420..a7731ca526a 100644 --- a/addons/caldav/__init__.py +++ b/addons/caldav/__init__.py @@ -20,10 +20,10 @@ ############################################################################## import caldav -import caldav_cache -import caldav_fs -import caldav_node -import webdav_server +#import caldav_cache +#import caldav_fs +#import caldav_node +#import webdav_server import wizard # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/caldav/__terp__.py b/addons/caldav/__terp__.py index db6e46b1daa..1d25ad8cb77 100644 --- a/addons/caldav/__terp__.py +++ b/addons/caldav/__terp__.py @@ -49,7 +49,9 @@ "demo_xml" : [], "update_xml" : [ 'security/ir.model.access.csv', - 'caldav_wizard.xml', + 'wizard/calendar_event_export_view.xml', + 'wizard/calendar_event_import_view.xml', + 'wizard/calendar_event_subscribe_view.xml', 'caldav_view.xml' ], "installable" : True, diff --git a/addons/caldav/caldav_wizard.xml b/addons/caldav/caldav_wizard.xml deleted file mode 100644 index eaebba4234a..00000000000 --- a/addons/caldav/caldav_wizard.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/addons/caldav/wizard/__init__.py b/addons/caldav/wizard/__init__.py index 4ab34601a96..1c45cb2a191 100755 --- a/addons/caldav/wizard/__init__.py +++ b/addons/caldav/wizard/__init__.py @@ -19,9 +19,8 @@ # ############################################################################## -import wizard_cal_export -import wizard_cal_import -import wizard_cal_subscribe +import calendar_event_export +import calendar_event_import +import calendar_event_subscribe # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: - diff --git a/addons/caldav/wizard/calendar_event_export.py b/addons/caldav/wizard/calendar_event_export.py new file mode 100644 index 00000000000..3bee5a5089f --- /dev/null +++ b/addons/caldav/wizard/calendar_event_export.py @@ -0,0 +1,69 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# 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 . +# +############################################################################## + +from osv import fields, osv +from tools.translate import _ +import netsvc +import pooler +import time +import tools +import wizard +import base64 + +class calendar_event_export(osv.osv_memory): + """ + Export Calendar Event. + """ + def _process_export_ics(self, cr, uid, context): + """ + Get Default value for file_path field. + """ + model = context.get('model', 'basic.calendar') + model_obj = self.pool.get(model) + calendar = model_obj.export_cal(cr, uid, context['active_ids'], context) + #TODO: check why returns wrong value + return base64.encodestring(calendar) + + def _process_export_ics_name(self, cr, uid, context): + """ + Get Default value for Name field. + """ + model = context.get('model', 'basic.calendar') + model_obj = self.pool.get(model) + calendar = model_obj.export_cal(cr, uid, context['active_ids'], context) + return 'OpenERP %s.ics' % (model_obj._description) + + _name = "calendar.event.export" + _description = "Event Export" + _columns = { + 'file_path':fields.binary('Save ICS file', filters='*.ics', required=True), + 'name':fields.char('File name', size=34, required=True, help='Save in .ics format') + } + + _defaults={ + 'name':_process_export_ics_name, + 'file_path':_process_export_ics + } + +calendar_event_export() + + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/caldav/wizard/calendar_event_export_view.xml b/addons/caldav/wizard/calendar_event_export_view.xml new file mode 100644 index 00000000000..0a049e15083 --- /dev/null +++ b/addons/caldav/wizard/calendar_event_export_view.xml @@ -0,0 +1,49 @@ + + + + + calendar.event.export.form + calendar.event.export + form + +
+ + + + + + +