Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
167 changes: 167 additions & 0 deletions caldav_sync/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
======================
CalDAV Synchronization
======================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:787f687ab1349cd7c1bf29f51915dfec832f8e17ca14a1a0cf48882977fc7d60
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fcalendar-lightgray.png?logo=github
:target: https://github.com/OCA/calendar/tree/18.0/caldav_sync
:alt: OCA/calendar
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/calendar-18-0/calendar-18-0-caldav_sync
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/calendar&target_branch=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

The CalDAV Synchronization module for Odoo allows users to synchronize
their calendar events with CalDAV servers. This enables seamless
integration of Odoo calendar with external applications like Apple
Calendar or Thunderbird.

Features
--------

- Synchronize Odoo calendar events with CalDAV servers.
- Create, update, and delete events in Odoo and reflect changes on the
CalDAV server.
- Poll CalDAV server for changes and update Odoo calendar accordingly.

Technical Details
-----------------

- The module extends the ``calendar.event`` model to add CalDAV
synchronization functionality.
- It uses the ``icalendar`` library to format events and the ``caldav``
library to interact with CalDAV servers.
- Polling for changes on the CalDAV server can be triggered manually by
triggering the scheduled action in Odoo.

**Table of contents**

.. contents::
:local:

Configuration
=============

1. Install the module in Odoo.
2. Go to the User settings in Odoo.
3. Enter the CalDAV calendar URL, username, and password on the user
settings.

Usage
=====

1. Create a calendar event in Odoo and it will be synchronized with the
CalDAV calendar.
2. Update the event in Odoo and the changes will reflect on the CalDAV
server.
3. Delete the event in Odoo and it will be removed from the CalDAV
server.
4. Changes made to the calendar on the CalDAV server (other email apps)
will be polled and updated in Odoo, by default every 10 minutes.

Changelog
=========

0.8.2
-----

- Restructured module for OCA compliance.

0.8.0
-----

- Disable sending of notification emails when events are created or
updated in Odoo during a CalDAV server synchronization.
- General code cleanup with improved type hints.

0.7.0
-----

- Stopped the import of past events when synchronizing from the CalDAV
server. This should help with performance, timeouts and avoid
importing events that are not relevant to the user.

0.6.0
-----

- Fixed an issue where synchronizing events created duplicate events on
every sync.
- Completely revamped and synchronization of recurring events in both
directions.

- Making a recurring event in Odoo correctly creates the recurring
event on the server.
- Modifying the base event of a recurrence with "all events" or
"future events" in Odoo reflects correctly on the server.
- Modifying a non-base event correctly updates on the server in all 3
modes (this event only, all events, future events).
- Modifying a base recurring event on the CalDAV server correctly
updates the events on Odoo after a synchronization.
- Deleting a whole recurring sequence from Odoo correctly deletes the
sequence from the CalDAV server.
- Deleting a single event or a whole recurring sequence on the CalDAV
server correctly synchronizes to Odoo after a synchronization.

- CalDAV (iCalendar) UIDs are now correctly shared among events of a
same recurrence in Odoo. This corrects a number of issues around
updating and deleting events from both the Odoo and CalDAV server
side.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/calendar/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/calendar/issues/new?body=module:%20caldav_sync%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
-------

* Bemade Inc.

Contributors
------------

- `Bemade Inc. <https://www.bemade.org>`__:

- Marc Durepos <marc@bemade.org>

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/calendar <https://github.com/OCA/calendar/tree/18.0/caldav_sync>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions caldav_sync/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
31 changes: 31 additions & 0 deletions caldav_sync/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Bemade Inc.
#
# Copyright (C) 2023-June Bemade Inc. (<https://www.bemade.org>).
# Author: Marc Durepos (Contact : mdurepos@durpro.com)
#
# This program is under the terms of the GNU Lesser General Public License (LGPL-3)
# For details, visit https://www.gnu.org/licenses/lgpl-3.0.en.html

{
"name": "CalDAV Synchronization",
"version": "18.0.0.8.2",
"license": "LGPL-3",
"category": "Productivity",
"summary": "Synchronize Odoo Calendar Events with CalDAV Servers",
"author": "Bemade Inc., Odoo Community Association (OCA)",
"website": "https://github.com/OCA/calendar",
"depends": ["base", "calendar"],
"development_status": "Beta",
# caldav > 2.0.1 is not compatible with Odoo 18.0 due to new dependencies introduced
"external_dependencies": {
"python": ["caldav>=1.3.9,<=2.0.1", "icalendar", "markdownify", "markdown2"],
},
"images": ["static/description/images/main_screenshot.png"],
"data": [
"views/res_users_views.xml",
"data/ir_cron_data.xml",
],
"installable": True,
"application": True,
"auto_install": False,
}
11 changes: 11 additions & 0 deletions caldav_sync/data/ir_cron_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<odoo noupdate="1">
<record id="ir_cron_caldav_sync" model="ir.cron">
<field name="name">CalDAV Sync</field>
<field name="model_id" ref="model_calendar_event" />
<field name="state">code</field>
<field name="code">model.poll_caldav_server()</field>
<field name="interval_number">10</field>
<field name="interval_type">minutes</field>
<field name="active" eval="True" />
</record>
</odoo>
8 changes: 8 additions & 0 deletions caldav_sync/data/neutralize.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
-- Neutralize CalDAV synchronization by setting credentials to NULL
UPDATE res_users
SET caldav_calendar_url = NULL,
caldav_username = NULL,
caldav_password = NULL
WHERE caldav_calendar_url IS NOT NULL
OR caldav_username IS NOT NULL
OR caldav_password IS NOT NULL;
4 changes: 4 additions & 0 deletions caldav_sync/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from . import calendar_event
from . import res_users
from . import calendar_recurrence
from . import calendar_attendee
24 changes: 24 additions & 0 deletions caldav_sync/models/calendar_attendee.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import logging

from odoo import models

_logger = logging.getLogger(__name__)


class CalendarAttendee(models.Model):
_inherit = "calendar.attendee"

def _send_mail_to_attendees(self, mail_template, force_send=False):
"""Override to prevent sending emails when dont_notify context is set.

:param mail_template: a mail.template record
:param force_send: if set to True, the mail(s) will be sent immediately
(instead of the next queue processing)
:return: Result of super or False if notification is skipped
"""
# Check for dont_notify in context
if self.env.context.get("dont_notify"):
_logger.info("Email notifications skipped due to dont_notify context")
return False

return super()._send_mail_to_attendees(mail_template, force_send)
Loading