Skip to content
Closed
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
1 change: 1 addition & 0 deletions hr_holidays_google_calendar/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
37 changes: 37 additions & 0 deletions hr_holidays_google_calendar/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
##############################################################################
#
# Copyright (C) 2024 ADHOC SA (http://www.adhoc.com.ar)
# All Rights Reserved.
#
# 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 <http://www.gnu.org/licenses/>.
#
##############################################################################
{
"name": "Holidays Google Calendar",
"version": "19.0.1.0.0",
"category": "Human Resources",
"summary": "Suppress Google Calendar invitations when approving time off",
"author": "ADHOC SA",
"website": "www.adhoc.com.ar",
"license": "AGPL-3",
"depends": [
"hr_holidays",
"google_calendar",
],
"data": [],
"demo": [],
"installable": True,
"auto_install": True,
"application": False,
}
1 change: 1 addition & 0 deletions hr_holidays_google_calendar/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import calendar_event
14 changes: 14 additions & 0 deletions hr_holidays_google_calendar/models/calendar_event.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from odoo import models
from odoo.addons.google_calendar.models.google_sync import TIMEOUT


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

def _google_insert(self, google_service, values, timeout=TIMEOUT):
# When hr_holidays creates a leave event it sets no_mail_to_attendees=True,
# meaning Odoo itself must not notify attendees. Honour that restriction in
# Google Calendar too by suppressing the sendUpdates notification.
if self.env.context.get("no_mail_to_attendees"):
self = self.with_context(send_updates=False)
return super()._google_insert(google_service, values, timeout=timeout)
1 change: 1 addition & 0 deletions hr_holidays_microsoft_calendar/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
37 changes: 37 additions & 0 deletions hr_holidays_microsoft_calendar/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
##############################################################################
#
# Copyright (C) 2024 ADHOC SA (http://www.adhoc.com.ar)
# All Rights Reserved.
#
# 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 <http://www.gnu.org/licenses/>.
#
##############################################################################
{
"name": "Holidays Microsoft Calendar",
"version": "19.0.1.0.0",
"category": "Human Resources",
"summary": "Suppress Outlook invitations when approving time off",
"author": "ADHOC SA",
"website": "www.adhoc.com.ar",
"license": "AGPL-3",
"depends": [
"hr_holidays",
"microsoft_calendar",
],
"data": [],
"demo": [],
"installable": True,
"auto_install": True,
"application": False,
}
1 change: 1 addition & 0 deletions hr_holidays_microsoft_calendar/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import calendar_event
15 changes: 15 additions & 0 deletions hr_holidays_microsoft_calendar/models/calendar_event.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from odoo import models


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

def _microsoft_values(self, fields_to_sync, initial_values=()):
# When hr_holidays creates a leave event it sets no_mail_to_attendees=True,
# meaning Odoo itself must not notify attendees. Honour that restriction for
# Outlook too by removing attendees from the Graph API payload so Microsoft
# does not send invitation emails on its side.
values = super()._microsoft_values(fields_to_sync, initial_values)
if self.env.context.get("no_mail_to_attendees"):
values.pop("attendees", None)
return values
Loading