Skip to content
Draft
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
201 changes: 201 additions & 0 deletions calendar_shared_ics/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
======================================
Shared ICS calendars (token-protected)
======================================

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

.. |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-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fcalendar-lightgray.png?logo=github
:target: https://github.com/OCA/calendar/tree/16.0/calendar_shared_ics
:alt: OCA/calendar
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/calendar-16-0/calendar-16-0-calendar_shared_ics
: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=16.0
:alt: Try me on Runboat

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

This module allows sharing an Odoo calendar as a read-only ICS feed that can be
subscribed to in external calendar clients such as Outlook, Google Calendar,
and Thunderbird.

The calendar is exposed via a public URL protected by an access token and can be
added as a network calendar (ICS / ``webcal://``). External calendar clients periodically
refresh the feed, providing near-real-time visibility of Odoo events without any
write-back capability.

Odoo includes bidirectional calendar synchronisation with external providers such as
Outlook and Google Calendar. In practice, however, this integration is not always
sufficiently robust and can suffer from functional limitations, data inconsistencies,
or bugs—especially in environments with complex recurrence rules, shared resources,
or high event volumes.

This module provides a simple, reliable, and intentionally one-directional
alternative:

* Events are exported from Odoo as a **read-only ICS calendar**
* External clients periodically fetch the feed
* No changes are ever written back into Odoo
* Old events can be excluded by default to improve synchronisation performance

Typical use cases include:

* Sharing planning or resource bookings with internal employees
* Providing customers or partners with insight into scheduled events
* Publishing operational calendars without exposing the Odoo backend
* Avoiding conflicts or data corruption caused by two-way synchronisation

Each shared calendar feed can be configured individually, including:

* Restricting events to a specific attendee (partner)
* Applying additional custom event filters
* Limiting exports to recent and future events only
* Generating and rotating access tokens
* Sharing the feed via the standard Odoo portal share wizard

**Security notice**

The calendar feed is protected solely by an **access token embedded in the URL**.
Anyone in possession of this URL can view the calendar contents.

The token grants **read-only access** and does **not** allow modification of data or
configuration of the feed. Nevertheless, the URL should be treated as confidential and
shared only with trusted recipients.

**Table of contents**

.. contents::
:local:

Usage
=====


Only users with the *Shared ICS manager* role can create or modify
shared calendar feeds.

#. Go to *Calendar → Configuration → Shared ICS*
#. Create a new *Shared ICS calendar*
#. Configure the feed:

* Select the **partner** whose events should be exported
* Optionally restrict events further using **Additional Filtering**
* Optionally limit the feed to **recent and future events only**
* Adjust user-related filters to easily select internal or portal users

Each record represents one independent, read-only calendar feed.

Regular users can only **view their own feed** (if any) but cannot
create, modify, or delete shared calendars.

Generate a share link

#. Open the shared calendar feed record
#. Click **Share**
#. The standard Odoo *Share* wizard will open
#. Select one or more recipients and send the email

The email contains a link to a landing page where the recipient can
copy the actual subscription URL.

Subscribe from an external calendar

#. Open the link from the email
#. Copy either the **``webcal://``** or **``https://``** URL shown on the page
#. Add it as a network / public calendar in your calendar client

Examples:

* **Outlook**

*Add calendar → Subscribe from web*

* **Google Calendar**

*Settings → Add calendar → From URL*

* **Thunderbird**

*New Calendar → On the Network → iCalendar (ICS)*

The external calendar will periodically refresh the feed.
All events are **read-only** and cannot be modified from the external client.

Rotate access token (optional)

If a subscription URL is compromised:

#. Open the shared calendar feed
#. Click **Rotate access token**
#. A new token is generated immediately

All previously issued URLs stop working at once, while the new URL
continues to function without further configuration.

Known issues / Roadmap
======================

* Optional **IP restriction** for shared calendar feeds
* Optional **expiration date** for access tokens
* Per-feed refresh hints / cache control options

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:%20calendar_shared_ics%0Aversion:%2016.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
~~~~~~~

* Therp BV

Contributors
~~~~~~~~~~~~

* Nikos Tsirintanis <ntsirintanis@therp.nl>

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.

.. |maintainer-ntsirintanis| image:: https://github.com/ntsirintanis.png?size=40px
:target: https://github.com/ntsirintanis
:alt: ntsirintanis

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-ntsirintanis|

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

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions calendar_shared_ics/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import controllers
from . import models
23 changes: 23 additions & 0 deletions calendar_shared_ics/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2025 Therp BV <https://therp.nl>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)
{
"name": "Shared ICS calendars (token-protected)",
"version": "16.0.1.0.0",
"category": "Calendar",
"summary": "Share readonly calendar feeds via ICS with access tokens",
"license": "AGPL-3",
"author": "Therp BV, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/calendar",
"depends": ["calendar", "portal", "mail"],
"data": [
"security/res_groups.xml",
"security/ir.model.access.csv",
"security/ir_rule.xml",
"views/calendar_shared_ics_views.xml",
"views/landing_page.xml",
],
"installable": True,
"application": False,
"external_dependencies": {"python": ["vobject"]},
"maintainers": ["ntsirintanis"],
}
1 change: 1 addition & 0 deletions calendar_shared_ics/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import main
65 changes: 65 additions & 0 deletions calendar_shared_ics/controllers/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Copyright 2025 Therp BV <https://therp.nl>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)
from odoo.http import Controller, content_disposition, request, route


class CalendarSharedIcsController(Controller):
@route(
["/calendar/shared/<model('calendar.shared.ics'):shared>/ics"],
type="http",
auth="public",
csrf=False,
sitemap=False,
)
def calendar_shared_ics(self, shared, **kwargs):
# super minimal, all the actual work
# takes place in calendar.shared.ics
shared = shared.sudo()
if not shared.exists() or not shared.active:
return request.not_found()
if not shared._check_access_token(kwargs.get("access_token")):
return request.not_found()
try:
content = shared._render_ics_content()
except Exception:
return request.not_found()
filename = shared._get_ics_filename()
return request.make_response(
content,
[
("Content-Type", "text/calendar; charset=utf-8"),
("Content-Disposition", content_disposition(filename)),
("Cache-Control", "no-store"),
],
)

@route(
["/calendar/shared/<model('calendar.shared.ics'):shared>/landing"],
type="http",
auth="public",
csrf=False,
sitemap=False,
)
def calendar_shared_ics_landing(self, shared, **kwargs):
# Public landing page: user can copy/paste the https/webcal subscription URL.
# and also login in the backend, if internal
shared = shared.sudo()
if not shared.exists() or not shared.active:
return request.not_found()
if not shared._check_access_token(kwargs.get("access_token")):
return request.not_found()
shared._portal_ensure_token()
backend_url = "%s/web#id=%s&model=%s&view_type=form" % (
shared.get_base_url(),
shared.id,
shared._name,
)
return request.render(
"calendar_shared_ics.shared_ics_landing_page",
{
"shared": shared,
"ics_url": shared.share_url,
"webcal_url": shared.share_webcal_url,
"backend_url": backend_url,
},
)
1 change: 1 addition & 0 deletions calendar_shared_ics/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import calendar_shared_ics
Loading