Skip to content

Commit

Permalink
[MIG] hr_holidays_summary_email: Migration to 15.0
Browse files Browse the repository at this point in the history
  • Loading branch information
JordiMForgeFlow committed Feb 20, 2024
1 parent b1e0396 commit 8155f0d
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 40 deletions.
12 changes: 6 additions & 6 deletions hr_holidays_summary_email/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Holidays Summary Email
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:5b86ab27fe5fce4b3f08db41d6887306ca1857a3fdbf1ee3034d5da210aaf1ea
!! source digest: sha256:f1265d7ee3d6a0e55298f1e6c7e6d29492327378e1ebde255497ef87ac4b3dd9
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand All @@ -17,13 +17,13 @@ Holidays Summary Email
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fhr--holidays-lightgray.png?logo=github
:target: https://github.com/OCA/hr-holidays/tree/14.0/hr_holidays_summary_email
:target: https://github.com/OCA/hr-holidays/tree/15.0/hr_holidays_summary_email
:alt: OCA/hr-holidays
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/hr-holidays-14-0/hr-holidays-14-0-hr_holidays_summary_email
:target: https://translation.odoo-community.org/projects/hr-holidays-15-0/hr-holidays-15-0-hr_holidays_summary_email
: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/hr-holidays&target_branch=14.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/hr-holidays&target_branch=15.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand Down Expand Up @@ -55,7 +55,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/hr-holidays/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/hr-holidays/issues/new?body=module:%20hr_holidays_summary_email%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/hr-holidays/issues/new?body=module:%20hr_holidays_summary_email%0Aversion:%2015.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.

Expand Down Expand Up @@ -95,6 +95,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-JordiMForgeFlow|

This module is part of the `OCA/hr-holidays <https://github.com/OCA/hr-holidays/tree/14.0/hr_holidays_summary_email>`_ project on GitHub.
This module is part of the `OCA/hr-holidays <https://github.com/OCA/hr-holidays/tree/15.0/hr_holidays_summary_email>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 1 addition & 1 deletion hr_holidays_summary_email/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"summary": """
Notify employees with daily or weekly leaves summaries of their company.
""",
"version": "14.0.1.0.1",
"version": "15.0.1.0.0",
"category": "Human Resources",
"website": "https://github.com/OCA/hr-holidays",
"author": "ForgeFlow, Odoo Community Association (OCA)",
Expand Down
20 changes: 7 additions & 13 deletions hr_holidays_summary_email/models/res_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,10 @@ class ResUser(models.Model):
related="employee_id.hr_leave_summary_type", readonly=False, related_sudo=False
)

def __init__(self, pool, cr):
"""Override of __init__ to add access rights.
Access rights are disabled by default, but allowed
on some specific fields defined in self.SELF_{READ/WRITE}ABLE_FIELDS.
"""
super(ResUser, self).__init__(pool, cr)
# duplicate list to avoid modifying the original reference
type(self).SELF_READABLE_FIELDS = type(self).SELF_READABLE_FIELDS + [
"hr_leave_summary_type"
]
type(self).SELF_WRITEABLE_FIELDS = type(self).SELF_WRITEABLE_FIELDS + [
"hr_leave_summary_type"
]
@property
def SELF_READABLE_FIELDS(self):
return super().SELF_READABLE_FIELDS + ["hr_leave_summary_type"]

@property
def SELF_WRITEABLE_FIELDS(self):
return super().SELF_WRITEABLE_FIELDS + ["hr_leave_summary_type"]
8 changes: 4 additions & 4 deletions hr_holidays_summary_email/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -367,9 +367,9 @@ <h1 class="title">Holidays Summary Email</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:5b86ab27fe5fce4b3f08db41d6887306ca1857a3fdbf1ee3034d5da210aaf1ea
!! source digest: sha256:f1265d7ee3d6a0e55298f1e6c7e6d29492327378e1ebde255497ef87ac4b3dd9
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/hr-holidays/tree/14.0/hr_holidays_summary_email"><img alt="OCA/hr-holidays" src="https://img.shields.io/badge/github-OCA%2Fhr--holidays-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/hr-holidays-14-0/hr-holidays-14-0-hr_holidays_summary_email"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/hr-holidays&amp;target_branch=14.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/hr-holidays/tree/15.0/hr_holidays_summary_email"><img alt="OCA/hr-holidays" src="https://img.shields.io/badge/github-OCA%2Fhr--holidays-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/hr-holidays-15-0/hr-holidays-15-0-hr_holidays_summary_email"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/hr-holidays&amp;target_branch=15.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module allows sending a daily/weekly email to employees with a summary
of the leaves on that period of other employees in the same company.</p>
<p><strong>Table of contents</strong></p>
Expand Down Expand Up @@ -402,7 +402,7 @@ <h1><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/hr-holidays/issues">GitHub Issues</a>.
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
<a class="reference external" href="https://github.com/OCA/hr-holidays/issues/new?body=module:%20hr_holidays_summary_email%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/hr-holidays/issues/new?body=module:%20hr_holidays_summary_email%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
Expand Down Expand Up @@ -434,7 +434,7 @@ <h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
promote its widespread use.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
<p><a class="reference external image-reference" href="https://github.com/JordiMForgeFlow"><img alt="JordiMForgeFlow" src="https://github.com/JordiMForgeFlow.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/hr-holidays/tree/14.0/hr_holidays_summary_email">OCA/hr-holidays</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/hr-holidays/tree/15.0/hr_holidays_summary_email">OCA/hr-holidays</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
Expand Down
33 changes: 17 additions & 16 deletions hr_holidays_summary_email/tests/test_hr_leave_summary_email.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,37 @@
from odoo.tests import common


class TestHrLeaveSummaryEmail(common.TransactionCase):
def setUp(self):
super().setUp()
self.HrLeave = self.env["hr.leave"]
leave_type = self.env.ref("hr_holidays.hr_holiday_status_dv")
class TestHrLeaveSummaryEmail(common.SavepointCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.HrLeave = cls.env["hr.leave"]
leave_type = cls.env.ref("hr_holidays.hr_holiday_status_dv")
# Add allocation days for the test
leave_type.write({"allocation_type": "no"})
calendar = self.env.ref("resource.resource_calendar_std")
partner = self.env["res.partner"].create(
leave_type.write({"requires_allocation": "no"})
calendar = cls.env.ref("resource.resource_calendar_std")
partner = cls.env["res.partner"].create(
{
"name": "Test employee",
"type": "private",
"country_id": self.env.ref("base.es").id,
"country_id": cls.env.ref("base.es").id,
}
)
self.employee = self.env["hr.employee"].create(
cls.employee = cls.env["hr.employee"].create(
{
"name": "Test employee",
"address_home_id": partner.id,
"resource_calendar_id": calendar.id,
}
)
# Today leave
self.leave_1 = (
self.env["hr.leave"]
cls.leave_1 = (
cls.env["hr.leave"]
.with_context(leave_skip_state_check=True)
.create(
{
"name": "Test 1",
"employee_id": self.employee.id,
"employee_id": cls.employee.id,
"holiday_status_id": leave_type.id,
"date_from": datetime.today(),
"date_to": (datetime.today() + relativedelta(days=1)),
Expand All @@ -47,13 +48,13 @@ def setUp(self):
)

# Week leave
self.leave_2 = (
self.env["hr.leave"]
cls.leave_2 = (
cls.env["hr.leave"]
.with_context(leave_skip_state_check=True)
.create(
{
"name": "Test 2",
"employee_id": self.employee.id,
"employee_id": cls.employee.id,
"holiday_status_id": leave_type.id,
"date_from": (datetime.today() + relativedelta(days=3)),
"date_to": (datetime.today() + relativedelta(days=5)),
Expand Down

0 comments on commit 8155f0d

Please sign in to comment.