diff --git a/addons/crm/crm_caldav_wizard.xml b/addons/crm/crm_caldav_wizard.xml index 7ff8d305640..fa20285638d 100644 --- a/addons/crm/crm_caldav_wizard.xml +++ b/addons/crm/crm_caldav_wizard.xml @@ -4,6 +4,10 @@ name="caldav.crm.import" id="wizard_crm_cal_import" multi="True" /> + + diff --git a/addons/crm/crm_calendar.py b/addons/crm/crm_calendar.py index ab74724b938..f321138a2dd 100644 --- a/addons/crm/crm_calendar.py +++ b/addons/crm/crm_calendar.py @@ -104,7 +104,7 @@ class crm_case(osv.osv): 'freebusy' : fields.text('FreeBusy'), 'transparent' : fields.selection([('TRANSPARENT', 'TRANSPARENT'), \ ('OPAQUE', 'OPAQUE')], 'Trensparent'), - 'caldav_url' : fields.char('Caldav URL', size=34), + 'caldav_url' : fields.char('Caldav URL', size=264), 'exdate' : fields.text('Exception Date/Times', help="This property defines the list\ of date/time exceptions for arecurring calendar component."), 'exrule' : fields.text('Exception Rule', help="defines a rule or repeating pattern\ @@ -204,7 +204,8 @@ class crm_case(osv.osv): val.update({'section_id' : section_id}) is_exists = common.uid2openobjectid(cr, val['id'], self._name ) val.pop('id') - val.pop('create_date') + if val.has_key('create_date'): val.pop('create_date') + val['caldav_url'] = context.get('url') or '' if is_exists: self.write(cr, uid, [is_exists], val) else: diff --git a/addons/crm/wizard/__init__.py b/addons/crm/wizard/__init__.py index bcaad7e61ae..95d42ca9c5f 100644 --- a/addons/crm/wizard/__init__.py +++ b/addons/crm/wizard/__init__.py @@ -25,6 +25,7 @@ import wizard_crm_new_send_email import wizard_fetch_mail import wizard_cal_export import wizard_cal_import +import wizard_cal_subscribe import meeting_planify import wizard_partner_create diff --git a/addons/crm/wizard/wizard_cal_subscribe.py b/addons/crm/wizard/wizard_cal_subscribe.py new file mode 100644 index 00000000000..5b312a11e67 --- /dev/null +++ b/addons/crm/wizard/wizard_cal_subscribe.py @@ -0,0 +1,90 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2009 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 . +# +############################################################################## + +import wizard +import pooler +import urllib +import base64 + +class crm_cal_subscribe_wizard(wizard.interface): + form1 = ''' +
+ + + ''' + + form1_fields = { + 'url_path': { + 'string': 'Provide path for remote calendar', + 'type': 'char', + 'required': True, + 'size': 124 + } + } + display = ''' +
+ + ''' + + display_fields = { + 'msg': { + 'string': '', + 'type': 'text', + 'readonly': True, + } + } + + def _process_imp_ics(self, cr, uid, data, context=None): + global cnt + cnt = 0 + f = urllib.urlopen(data['form']['url_path']) + caldata= f.fp.read() + f.close() + case_obj = pooler.get_pool(cr.dbname).get('crm.case') + context.update({'url': data['form']['url_path']}) + vals = case_obj.import_cal(cr, uid, base64.encodestring(caldata), context) + if vals: + cnt = vals['count'] + return {} + + def _result_set(self, cr, uid, data, context=None): + return {'msg': 'Subscribed %s Event(s)' % cnt} + + states = { + 'init': { + 'actions': [], + 'result': {'type': 'form', 'arch': form1, 'fields': form1_fields, \ + 'state': [('end', '_Cancel', 'gtk-cancel'), ('open', '_Subscribe', 'gtk-ok')]} + }, + 'open': { + 'actions': [], + 'result': {'type': 'action', 'action': _process_imp_ics, 'state': 'display'} + }, + 'display': { + 'actions': [_result_set], + 'result': {'type': 'form', 'arch': display, 'fields': display_fields, \ + 'state': [('end', 'Ok', 'gtk-ok')]} + }, + } + +crm_cal_subscribe_wizard('caldav.crm.subscribe') + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file