Skip to content

Commit 83522c8

Browse files
committed
Merge PR #250 into 17.0
Signed-off-by pedrobaeza
2 parents 767b210 + dc5609c commit 83522c8

14 files changed

Lines changed: 675 additions & 0 deletions

File tree

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
.. image:: https://odoo-community.org/readme-banner-image
2+
:target: https://odoo-community.org/get-involved?utm_source=readme
3+
:alt: Odoo Community Association
4+
5+
==================================================
6+
HR Holidays Overview - Report Calendar Type filter
7+
==================================================
8+
9+
..
10+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
11+
!! This file is generated by oca-gen-addon-readme !!
12+
!! changes will be overwritten. !!
13+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
14+
!! source digest: sha256:05edb86db2d79880195b96e3448429122f5388e82b9a56accef381bfb9ea4b2f
15+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
16+
17+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
18+
:target: https://odoo-community.org/page/development-status
19+
:alt: Beta
20+
.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
21+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
22+
:alt: License: AGPL-3
23+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fhr--holidays-lightgray.png?logo=github
24+
:target: https://github.com/OCA/hr-holidays/tree/17.0/hr_holidays_leave_report_calendar_type
25+
:alt: OCA/hr-holidays
26+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
27+
:target: https://translation.odoo-community.org/projects/hr-holidays-17-0/hr-holidays-17-0-hr_holidays_leave_report_calendar_type
28+
:alt: Translate me on Weblate
29+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
30+
:target: https://runboat.odoo-community.org/builds?repo=OCA/hr-holidays&target_branch=17.0
31+
:alt: Try me on Runboat
32+
33+
|badge1| |badge2| |badge3| |badge4| |badge5|
34+
35+
By default, general calendar view for leaves ("Overview") has no leave
36+
type filter.
37+
38+
This addon simply adds it to right filter panel, and at search bar as
39+
well.
40+
41+
|Leave Type filters at Overview|
42+
43+
.. |Leave Type filters at Overview| image:: https://raw.githubusercontent.com/OCA/hr-holidays/17.0/hr_holidays_leave_report_calendar_type/static/img/01_calendar.png
44+
45+
**Table of contents**
46+
47+
.. contents::
48+
:local:
49+
50+
Bug Tracker
51+
===========
52+
53+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/hr-holidays/issues>`_.
54+
In case of trouble, please check there if your issue has already been reported.
55+
If you spotted it first, help us to smash it by providing a detailed and welcomed
56+
`feedback <https://github.com/OCA/hr-holidays/issues/new?body=module:%20hr_holidays_leave_report_calendar_type%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
57+
58+
Do not contact contributors directly about support or help with technical issues.
59+
60+
Credits
61+
=======
62+
63+
Authors
64+
-------
65+
66+
* Solvos
67+
68+
Contributors
69+
------------
70+
71+
- David Alonso <david.alonso@solvos.es>
72+
- Carlos García <carlos.garcia@solvos.es>
73+
74+
Maintainers
75+
-----------
76+
77+
This module is maintained by the OCA.
78+
79+
.. image:: https://odoo-community.org/logo.png
80+
:alt: Odoo Community Association
81+
:target: https://odoo-community.org
82+
83+
OCA, or the Odoo Community Association, is a nonprofit organization whose
84+
mission is to support the collaborative development of Odoo features and
85+
promote its widespread use.
86+
87+
This module is part of the `OCA/hr-holidays <https://github.com/OCA/hr-holidays/tree/17.0/hr_holidays_leave_report_calendar_type>`_ project on GitHub.
88+
89+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import models
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright 2026 Solvos Consultoría Informática, S.L. (<https://www.solvos.es>)
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
{
5+
"name": "HR Holidays Overview - Report Calendar Type filter",
6+
"summary": "Adds leave type filter to Time Off Overview calendar",
7+
"author": "Solvos, Odoo Community Association (OCA)",
8+
"website": "https://github.com/OCA/hr-holidays",
9+
"category": "Human Resources",
10+
"version": "17.0.1.0.0",
11+
"license": "AGPL-3",
12+
"depends": ["hr_holidays"],
13+
"data": ["report/hr_leave_report_calendar_views.xml"],
14+
"installable": True,
15+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import hr_leave_report_calendar
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Copyright 2026 Solvos Consultoría Informática, S.L. (<https://www.solvos.es>)
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from odoo import fields, models
5+
6+
7+
class LeaveReportCalendar(models.Model):
8+
_inherit = "hr.leave.report.calendar"
9+
10+
holiday_status_id = fields.Many2one(
11+
"hr.leave.type",
12+
string="Time Off Type",
13+
compute="_compute_holiday_status_id",
14+
search="_search_holiday_status_id",
15+
groups="hr_holidays.group_hr_holidays_user",
16+
)
17+
18+
def _compute_holiday_status_id(self):
19+
leaves = self.env["hr.leave"].browse(self.ids)
20+
leave_status_dict = {leave.id: leave.holiday_status_id for leave in leaves}
21+
for record in self:
22+
record.holiday_status_id = leave_status_dict.get(record.id, False)
23+
24+
def _search_holiday_status_id(self, operator, value):
25+
leaves = self.env["hr.leave"].search([("holiday_status_id", operator, value)])
26+
return [("id", "in", leaves.ids)]
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["whool"]
3+
build-backend = "whool.buildapi"
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- David Alonso \<david.alonso@solvos.es\>
2+
- Carlos García \<carlos.garcia@solvos.es\>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
By default, general calendar view for leaves ("Overview") has no leave type filter.
2+
3+
This addon simply adds it to right filter panel, and at search bar as well.
4+
5+
![Leave Type filters at Overview](../static/img/01_calendar.png)
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<odoo>
2+
<record id="hr_leave_report_calendar_view" model="ir.ui.view">
3+
<field
4+
name="name"
5+
>hr.leave.report.calendar.view (in hr_holidays_leave_calendar_type)</field>
6+
<field name="model">hr.leave.report.calendar</field>
7+
<field name="inherit_id" ref="hr_holidays.hr_leave_report_calendar_view" />
8+
<field name="arch" type="xml">
9+
<field name="employee_id" position="after">
10+
<field name="holiday_status_id" filters="1" invisible="1" />
11+
</field>
12+
</field>
13+
</record>
14+
15+
<record id="hr_leave_report_calendar_view_form" model="ir.ui.view">
16+
<field
17+
name="name"
18+
>hr.leave.report.calendar.view.form (in hr_holidays_leave_calendar_type)</field>
19+
<field name="model">hr.leave.report.calendar</field>
20+
<field name="inherit_id" ref="hr_holidays.hr_leave_report_calendar_view_form" />
21+
<field name="arch" type="xml">
22+
<field name="employee_id" position="after">
23+
<field name="holiday_status_id" />
24+
</field>
25+
</field>
26+
</record>
27+
28+
<record id="hr_leave_report_calendar_view_search" model="ir.ui.view">
29+
<field
30+
name="name"
31+
>hr.leave.report.calendar.view.search (in hr_holidays_leave_calendar_type)</field>
32+
<field name="model">hr.leave.report.calendar</field>
33+
<field
34+
name="inherit_id"
35+
ref="hr_holidays.hr_leave_report_calendar_view_search"
36+
/>
37+
<field name="arch" type="xml">
38+
<field name="employee_id" position="after">
39+
<field name="holiday_status_id" />
40+
</field>
41+
</field>
42+
</record>
43+
</odoo>
9.23 KB
Loading

0 commit comments

Comments
 (0)