diff --git a/show_unusual_days_on_calendar/__init__.py b/show_unusual_days_on_calendar/__init__.py new file mode 100644 index 0000000..9a7e03e --- /dev/null +++ b/show_unusual_days_on_calendar/__init__.py @@ -0,0 +1 @@ +from . import models \ No newline at end of file diff --git a/show_unusual_days_on_calendar/__manifest__.py b/show_unusual_days_on_calendar/__manifest__.py new file mode 100644 index 0000000..1c07f20 --- /dev/null +++ b/show_unusual_days_on_calendar/__manifest__.py @@ -0,0 +1,36 @@ +# Copyright 2022 Stéphan Sainléger (Elabore) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "show_unusual_days_on_calendar", + "version": "14.0.1.0.0", + "author": "Elabore", + "website": "https://elabore.coop", + "maintainer": "Clément Thomas / Laetitia Da Costa", + "license": "AGPL-3", + "category": "Tools", + "summary": "show unusual days such as leaves or holidays on event calendar in the same way it does in hr_leave calendar \n (event in gray background and white borders)", + # any module necessary for this one to work correctly + "depends": [ + "calendar", + "hr_holidays", + ], + "qweb": [ + ], + "external_dependencies": { + "python": [], + }, + # always loaded + "data": [ + 'views/calendar_event_views.xml', + ], + # only loaded in demonstration mode + "demo": [], + "js": [], + "css": [], + "installable": True, + # Install this module automatically if all dependency have been previously + # and independently installed. Used for synergetic or glue modules. + "auto_install": False, + "application": False, +} \ No newline at end of file diff --git a/show_unusual_days_on_calendar/models/__init__.py b/show_unusual_days_on_calendar/models/__init__.py new file mode 100644 index 0000000..2b258a6 --- /dev/null +++ b/show_unusual_days_on_calendar/models/__init__.py @@ -0,0 +1 @@ +from . import calendar_event \ No newline at end of file diff --git a/show_unusual_days_on_calendar/models/calendar_event.py b/show_unusual_days_on_calendar/models/calendar_event.py new file mode 100644 index 0000000..445aca2 --- /dev/null +++ b/show_unusual_days_on_calendar/models/calendar_event.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from odoo import api, fields, models +from datetime import datetime, time + +class CalendarEvent(models.Model): + _inherit = 'calendar.event' + + @api.model + def get_unusual_days(self, date_from, date_to=None): + return self.env['hr.leave'].get_unusual_days(date_from, date_to=date_to) \ No newline at end of file diff --git a/show_unusual_days_on_calendar/views/calendar_event_views.xml b/show_unusual_days_on_calendar/views/calendar_event_views.xml new file mode 100644 index 0000000..0dfad06 --- /dev/null +++ b/show_unusual_days_on_calendar/views/calendar_event_views.xml @@ -0,0 +1,15 @@ + + + + + calendar.event.calendar.unusual.days.inherit + calendar.event + + + + True + + + + + \ No newline at end of file