Skip to content

Commit

Permalink
[MIG] hr_holidays_auto_extend: Migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
luisDIXMIT committed Aug 2, 2024
1 parent 9191536 commit 3ba7756
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 31 deletions.
10 changes: 5 additions & 5 deletions hr_holidays_auto_extend/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ Hr Holidays Auto Extend
: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_auto_extend
:target: https://github.com/OCA/hr-holidays/tree/16.0/hr_holidays_auto_extend
: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_auto_extend
:target: https://translation.odoo-community.org/projects/hr-holidays-16-0/hr-holidays-16-0-hr_holidays_auto_extend
: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=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand Down Expand Up @@ -51,7 +51,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_auto_extend%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_auto_extend%0Aversion:%2016.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 @@ -82,6 +82,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/hr-holidays <https://github.com/OCA/hr-holidays/tree/14.0/hr_holidays_auto_extend>`_ project on GitHub.
This module is part of the `OCA/hr-holidays <https://github.com/OCA/hr-holidays/tree/16.0/hr_holidays_auto_extend>`_ 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_auto_extend/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"name": "Hr Holidays Auto Extend",
"summary": """
Allow to extend some kind of holidays""",
"version": "14.0.1.0.0",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"author": "CreuBlanca,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/hr-holidays",
Expand Down
2 changes: 1 addition & 1 deletion hr_holidays_auto_extend/data/mail.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<field name="name">Leave cannot be extended due to overlapping</field>
<field name="summary">note</field>
<field name="category">default</field>
<field name="res_model_id" ref="hr_holidays.model_hr_leave" />
<field name="res_model">hr.leave</field>
<field name="icon">fa-tasks</field>
<field name="delay_count">0</field>
</record>
Expand Down
17 changes: 7 additions & 10 deletions hr_holidays_auto_extend/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@

/*
:Author: David Goodger ([email protected])
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Copyright: This stylesheet has been placed in the public domain.

Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.

See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
Expand Down Expand Up @@ -275,7 +274,7 @@
margin-left: 2em ;
margin-right: 2em }

pre.code .ln { color: gray; } /* line numbers */
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
Expand All @@ -301,7 +300,7 @@
span.pre {
white-space: pre }

span.problematic, pre.problematic {
span.problematic {
color: red }

span.section-subtitle {
Expand Down Expand Up @@ -369,7 +368,7 @@ <h1 class="title">Hr Holidays Auto Extend</h1>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:00afe160865b13f5c2f5f4032e011cd1bb43e32a86dfbe8c57308679759017b8
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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_auto_extend"><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_auto_extend"><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/16.0/hr_holidays_auto_extend"><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-16-0/hr-holidays-16-0-hr_holidays_auto_extend"><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=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>With this module, we will be able to extend automatically a leave when the period is reached.</p>
<p>This might be necessary for leaves without a clear return date for the employee.</p>
<p><strong>Table of contents</strong></p>
Expand Down Expand Up @@ -399,7 +398,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_auto_extend%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_auto_extend%0Aversion:%2016.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 All @@ -420,13 +419,11 @@ <h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/hr-holidays/tree/14.0/hr_holidays_auto_extend">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/16.0/hr_holidays_auto_extend">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
63 changes: 49 additions & 14 deletions hr_holidays_auto_extend/tests/test_extend.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,17 @@ def test_time_type(self):
"name": "Paid Time Off",
"time_type": "leave",
"auto_extend": True,
"allocation_type": "no",
"validity_start": False,
}
)
date_to = fields.Date.today() - timedelta(days=2)
f = Form(self.env["hr.leave"])
f = Form(
self.env["hr.leave"].with_context(
default_employee_id=self.env["hr.employee"]
.browse(self.employee_hruser_id)
.id
)
)
f.name = "Doctor Appointment"
f.employee_id = self.env["hr.employee"].browse(self.employee_hruser_id)
f.holiday_status_id = leave_type
f.request_date_from = fields.Date.today() - timedelta(days=5)
f.request_date_to = date_to
Expand All @@ -48,30 +51,36 @@ def test_extend_overlap(self):
"name": "Paid Time Off",
"time_type": "leave",
"auto_extend": True,
"allocation_type": "no",
"validity_start": False,
}
)
leave_type_02 = self.env["hr.leave.type"].create(
{
"name": "Another leave type",
"time_type": "leave",
"allocation_type": "no",
"validity_start": False,
}
)
date_to = fields.Date.today() - timedelta(days=2)
f = Form(self.env["hr.leave"])
f = Form(
self.env["hr.leave"].with_context(
default_employee_id=self.env["hr.employee"]
.browse(self.employee_hruser_id)
.id
)
)
f.name = "Doctor Appointment"
f.employee_id = self.env["hr.employee"].browse(self.employee_hruser_id)
f.holiday_status_id = leave_type
f.request_date_from = fields.Date.today() - timedelta(days=5)
f.request_date_to = date_to
leave_1 = f.save()

f2 = Form(self.env["hr.leave"])
f2 = Form(
self.env["hr.leave"].with_context(
default_employee_id=self.env["hr.employee"]
.browse(self.employee_hruser_id)
.id
)
)
f2.name = "Doctor Appointment"
f2.employee_id = self.env["hr.employee"].browse(self.employee_hruser_id)
f2.holiday_status_id = leave_type_02
f2.request_date_from = fields.Date.today() - timedelta(days=1)
f2.request_date_to = fields.Date.today()
Expand All @@ -83,7 +92,33 @@ def test_extend_overlap(self):
self.assertTrue(leave_1.auto_extend)
self.assertFalse(leave_1.activity_ids)
self.env["hr.leave"]._cron_auto_extend()
leave_1.flush()
leave_1.refresh()
leave_1.flush_recordset()
leave_1.invalidate_recordset()
self.assertFalse(leave_1.auto_extend)
self.assertTrue(leave_1.activity_ids)

def test_check_date_state(self):
leave_type = self.env["hr.leave.type"].create(
{
"name": "Paid Time Off",
"time_type": "leave",
"auto_extend": True,
}
)
leave = (
self.env["hr.leave"]
.with_context(__no_check_state_date=True)
.create(
{
"name": "Doctor Appointment",
"employee_id": self.employee_hruser_id,
"holiday_status_id": leave_type.id,
"request_date_from": fields.Date.today() - timedelta(days=5),
"request_date_to": fields.Date.today() - timedelta(days=2),
}
)
)

res = leave._check_date_state()

self.assertEqual(res, None)

0 comments on commit 3ba7756

Please sign in to comment.