[ADD]show_unusual_days_on_calendar

This commit is contained in:
2024-05-02 17:02:37 +02:00
parent fb012e4362
commit 547cac2aca
5 changed files with 65 additions and 0 deletions

View File

@@ -0,0 +1 @@
from . import models

View File

@@ -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,
}

View File

@@ -0,0 +1 @@
from . import calendar_event

View File

@@ -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)

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
<record id="view_calendar_event_calendar_unusual_days_inherit" model="ir.ui.view">
<field name="name">calendar.event.calendar.unusual.days.inherit</field>
<field name="model">calendar.event</field>
<field name="inherit_id" ref="calendar.view_calendar_event_calendar"/>
<field name="arch" type="xml">
<calendar position="attributes">
<attribute name="show_unusual_days">True</attribute>
</calendar>
</field>
</record>
</data>
</odoo>