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
77 changes: 77 additions & 0 deletions calendar_dav/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
============
Calendar dav
============

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

.. |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/18.0/calendar_dav
: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-calendar_dav
: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|

This module adds the missing link between basedav and the Odoo calendar.
Collections should point to the UUID field of the calendar.event models.

**Table of contents**

.. contents::
:local:

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_dav%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
-------

* initOS GmbH

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

- Florian Kantelberg <florian.kantelberg@initos.com>

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/calendar_dav>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
5 changes: 5 additions & 0 deletions calendar_dav/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright 2022 initOS GmbH
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from . import models
from .hooks import post_init_hook
20 changes: 20 additions & 0 deletions calendar_dav/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2022 initOS GmbH
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

{
"name": "Calendar dav",
"summary": "Extension of the base_dav module to work better with the calendar",
"version": "18.0.1.0.2",
"category": "Calendar",
"website": "https://github.com/OCA/calendar",
"author": "initOS GmbH, Odoo Community Association (OCA)",
"license": "AGPL-3",
"application": False,
"installable": True,
"auto_install": True,
"post_init_hook": "post_init_hook",
"depends": [
"base_dav",
"calendar",
],
}
16 changes: 16 additions & 0 deletions calendar_dav/hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2022 initOS GmbH
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

import logging
from uuid import uuid4

_logger = logging.getLogger(__name__)


def post_init_hook(env):
"""
Fetches all the PO and resets the sequence of the purchase order lines.
"""
_logger.info("Setting unique UUID for calendar events")
for event in env["calendar.event"].search([]):
event.uuid = str(uuid4())
25 changes: 25 additions & 0 deletions calendar_dav/i18n/calendar_dav.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * calendar_dav
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: calendar_dav
#: model:ir.model,name:calendar_dav.model_calendar_event
msgid "Event"
msgstr ""

#. module: calendar_dav
#: model:ir.model.fields,field_description:calendar_dav.field_calendar_event_uuid
msgid "Uuid"
msgstr ""

5 changes: 5 additions & 0 deletions calendar_dav/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright 2022 initOS GmbH
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from . import calendar_event
from . import dav_collection
12 changes: 12 additions & 0 deletions calendar_dav/models/calendar_event.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright 2022 initOS GmbH
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from uuid import uuid4

from odoo import fields, models


class CalendarEvent(models.Model):
_inherit = "calendar.event"

uuid = fields.Char(readonly=True, default=lambda self: str(uuid4()))
36 changes: 36 additions & 0 deletions calendar_dav/models/dav_collection.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from odoo import models


class DavCollection(models.Model):
_inherit = "dav.collection"

def dav_upload(self, collection, href, item):
result = super().dav_upload(collection, href, item)
if self.model_id.model != "calendar.event":
return result
if not hasattr(item, "vevent"):
return result
user_email = self.env.user.partner_id.email
for attendee_item in item.vevent.contents.get("attendee", []):
email = attendee_item.value.replace("mailto:", "").strip()
if email != user_email:
continue
partstat = attendee_item.params.get("PARTSTAT", ["NEEDS-ACTION"])[0]
state = {
"NEEDS-ACTION": "needsAction",
"ACCEPTED": "accepted",
"DECLINED": "declined",
"TENTATIVE": "tentative",
}.get(partstat, "needsAction")
components = self._split_path(href)
rec = self.get_record(components)
if rec:
att = rec.attendee_ids.filtered(
lambda a: a.partner_id.email == user_email
)
if att:
att.write({"state": state})
break
return result
3 changes: 3 additions & 0 deletions calendar_dav/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
1 change: 1 addition & 0 deletions calendar_dav/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Florian Kantelberg \<<florian.kantelberg@initos.com>\>
2 changes: 2 additions & 0 deletions calendar_dav/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module adds the missing link between basedav and the Odoo calendar.
Collections should point to the UUID field of the calendar.event models.
Binary file added calendar_dav/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading