diff options
| author | Richard Mathot <rim@odoo.com> | 2016-09-27 18:50:49 +0200 |
|---|---|---|
| committer | Jérome Maes <jem@openerp.com> | 2016-09-28 13:43:20 +0200 |
| commit | 2bb37b5d1e41d9dd21ec59b8913b7ec366f0bc29 (patch) | |
| tree | 2bb0fb1cb7b6d51df227166f0e359733e64f861a | |
| parent | 4dd31f645e00fbb897bfcd057705383bbfd3c8a4 (diff) | |
[FIX] calendar: don't crash on missing optional dependency
For historical reasons, `vobject`* Python library is not mandatory in
Odoo.
Since refactoring 6af6148a243374b7004aae719b9855df9393913e,
get_ics_file() returns now a dictionary whose keys are calendar.event
ids and values are the corresponding ics file.
If `vobject` is not available, it returns an empty dictionary that
could cause calendar.py to crash because it always expects to find the
event's key.
Before this refactoring, this method was called and architectured in a
different manner, so no crash was happening.
This commit prevents the crash if `vobject` is not installed and logs a
warning.
*vobject allows to generate iCalendar files
| -rw-r--r-- | addons/calendar/models/calendar.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/addons/calendar/models/calendar.py b/addons/calendar/models/calendar.py index 315f2f5d411..bd65166fd65 100644 --- a/addons/calendar/models/calendar.py +++ b/addons/calendar/models/calendar.py @@ -160,7 +160,7 @@ class Attendee(models.Model): mails_to_send = self.env['mail.mail'] for attendee in self: if attendee.email or attendee.partner_id.email: - ics_file = ics_files[attendee.event_id.id] + ics_file = ics_files.get(attendee.event_id.id) mail_id = invitation_template.send_mail(attendee.id) vals = {} @@ -850,6 +850,7 @@ class Meeting(models.Model): # FIXME: why isn't this in CalDAV? import vobject except ImportError: + _logger.warning("The `vobject` Python module is not installed, so iCal file generation is unavailable. Use 'pip install vobject' to install it") return result for meeting in self: |
