Skip to content

Commit e9f5914

Browse files
[MIG] hr_contract_update_overtime: Migration to 17.0
1 parent e94fefc commit e9f5914

File tree

8 files changed

+54
-47
lines changed

8 files changed

+54
-47
lines changed

hr_contract_update_overtime/README.rst

+10-9
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ Update Overtime from HR Contract
1717
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
1818
:alt: License: LGPL-3
1919
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fhr--attendance-lightgray.png?logo=github
20-
:target: https://github.com/OCA/hr-attendance/tree/16.0/hr_contract_update_overtime
20+
:target: https://github.com/OCA/hr-attendance/tree/17.0/hr_contract_update_overtime
2121
:alt: OCA/hr-attendance
2222
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23-
:target: https://translation.odoo-community.org/projects/hr-attendance-16-0/hr-attendance-16-0-hr_contract_update_overtime
23+
:target: https://translation.odoo-community.org/projects/hr-attendance-17-0/hr-attendance-17-0-hr_contract_update_overtime
2424
:alt: Translate me on Weblate
2525
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26-
:target: https://runboat.odoo-community.org/builds?repo=OCA/hr-attendance&target_branch=16.0
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/hr-attendance&target_branch=17.0
2727
:alt: Try me on Runboat
2828

2929
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -34,9 +34,9 @@ Overtime.
3434

3535
You can Update Overtime in different ways:
3636

37-
- An action on the Contract History tree view
38-
- Header button on Contract History form view
39-
- Header button on Contract form view
37+
- An action on the Contract History tree view
38+
- Header button on Contract History form view
39+
- Header button on Contract form view
4040

4141
If you Update Overtime from Contract History, leaves will also be
4242
reorganized across their contract calendars.
@@ -77,7 +77,7 @@ Bug Tracker
7777
Bugs are tracked on `GitHub Issues <https://github.com/OCA/hr-attendance/issues>`_.
7878
In case of trouble, please check there if your issue has already been reported.
7979
If you spotted it first, help us to smash it by providing a detailed and welcomed
80-
`feedback <https://github.com/OCA/hr-attendance/issues/new?body=module:%20hr_contract_update_overtime%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
80+
`feedback <https://github.com/OCA/hr-attendance/issues/new?body=module:%20hr_contract_update_overtime%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
8181

8282
Do not contact contributors directly about support or help with technical issues.
8383

@@ -92,7 +92,8 @@ Authors
9292
Contributors
9393
------------
9494

95-
- Eduardo de Miguel (`Moduon <https://www.moduon.team/>`__)
95+
- Eduardo de Miguel (`Moduon <https://www.moduon.team/>`__)
96+
- ``Heliconia Solutions Pvt. Ltd. <https://www.heliconia.io>``\ \_
9697

9798
Maintainers
9899
-----------
@@ -118,6 +119,6 @@ Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:
118119

119120
|maintainer-Shide| |maintainer-rafaelbn|
120121

121-
This module is part of the `OCA/hr-attendance <https://github.com/OCA/hr-attendance/tree/16.0/hr_contract_update_overtime>`_ project on GitHub.
122+
This module is part of the `OCA/hr-attendance <https://github.com/OCA/hr-attendance/tree/17.0/hr_contract_update_overtime>`_ project on GitHub.
122123

123124
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

hr_contract_update_overtime/__manifest__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
{
55
"name": "Update Overtime from HR Contract",
66
"summary": "Update Overtime from HR Contract",
7-
"version": "16.0.1.0.0",
7+
"version": "17.0.1.0.0",
88
"development_status": "Alpha",
99
"category": "Human Resources/Contracts",
1010
"website": "https://github.com/OCA/hr-attendance",

hr_contract_update_overtime/data/hr_contract_history_data.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
<field name="name">Update Overtime</field>
88
<field name="model_id" ref="hr_contract.model_hr_contract_history" />
99
<field name="binding_model_id" ref="hr_contract.model_hr_contract_history" />
10-
<field name="binding_view_types">tree</field>
10+
<field name="binding_view_types">list</field>
1111
<field
1212
name="groups_id"
13-
eval="[(4, ref('hr_attendance.group_hr_attendance_user'))]"
13+
eval="[(4, ref('hr_attendance.group_hr_attendance_officer'))]"
1414
/>
1515
<field name="state">code</field>
1616
<field name="code">records.action_update_overtime()</field>
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
- Eduardo de Miguel ([Moduon](https://www.moduon.team/))
2+
- `Heliconia Solutions Pvt. Ltd. <https://www.heliconia.io>`_

hr_contract_update_overtime/static/description/index.html

+4-3
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ <h1 class="title">Update Overtime from HR Contract</h1>
369369
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
370370
!! source digest: sha256:a735232b2f18ecb1807c245231cd5ad03f9ea9de28112c85bf14ea9345ad9bcb
371371
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
372-
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Alpha" src="https://img.shields.io/badge/maturity-Alpha-red.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/hr-attendance/tree/16.0/hr_contract_update_overtime"><img alt="OCA/hr-attendance" src="https://img.shields.io/badge/github-OCA%2Fhr--attendance-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/hr-attendance-16-0/hr-attendance-16-0-hr_contract_update_overtime"><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-attendance&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
372+
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Alpha" src="https://img.shields.io/badge/maturity-Alpha-red.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/hr-attendance/tree/17.0/hr_contract_update_overtime"><img alt="OCA/hr-attendance" src="https://img.shields.io/badge/github-OCA%2Fhr--attendance-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/hr-attendance-17-0/hr-attendance-17-0-hr_contract_update_overtime"><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-attendance&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
373373
<p>This module extends the functionality of Contracts and Attendances to
374374
support recalculating Overtime and to allow you to keep up to date your
375375
Overtime.</p>
@@ -424,7 +424,7 @@ <h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
424424
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/hr-attendance/issues">GitHub Issues</a>.
425425
In case of trouble, please check there if your issue has already been reported.
426426
If you spotted it first, help us to smash it by providing a detailed and welcomed
427-
<a class="reference external" href="https://github.com/OCA/hr-attendance/issues/new?body=module:%20hr_contract_update_overtime%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
427+
<a class="reference external" href="https://github.com/OCA/hr-attendance/issues/new?body=module:%20hr_contract_update_overtime%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
428428
<p>Do not contact contributors directly about support or help with technical issues.</p>
429429
</div>
430430
<div class="section" id="credits">
@@ -439,6 +439,7 @@ <h2><a class="toc-backref" href="#toc-entry-5">Authors</a></h2>
439439
<h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
440440
<ul class="simple">
441441
<li>Eduardo de Miguel (<a class="reference external" href="https://www.moduon.team/">Moduon</a>)</li>
442+
<li><tt class="docutils literal">Heliconia Solutions Pvt. Ltd. <span class="pre">&lt;https://www.heliconia.io&gt;</span></tt>_</li>
442443
</ul>
443444
</div>
444445
<div class="section" id="maintainers">
@@ -452,7 +453,7 @@ <h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
452453
promote its widespread use.</p>
453454
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainers</a>:</p>
454455
<p><a class="reference external image-reference" href="https://github.com/Shide"><img alt="Shide" src="https://github.com/Shide.png?size=40px" /></a> <a class="reference external image-reference" href="https://github.com/rafaelbn"><img alt="rafaelbn" src="https://github.com/rafaelbn.png?size=40px" /></a></p>
455-
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/hr-attendance/tree/16.0/hr_contract_update_overtime">OCA/hr-attendance</a> project on GitHub.</p>
456+
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/hr-attendance/tree/17.0/hr_contract_update_overtime">OCA/hr-attendance</a> project on GitHub.</p>
456457
<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>
457458
</div>
458459
</div>

hr_contract_update_overtime/tests/test_hr_contract_update_overtime.py

+33-29
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def setUpClass(cls):
2929

3030
def make_dtt(days_before, h=0, m=0, to_date=False):
3131
dat = datetime.combine(
32-
today - timedelta(days=days_before), datetime.min.time()
32+
today - timedelta(days=days_before + 1), datetime.min.time()
3333
).replace(hour=h, minute=m)
3434
if to_date:
3535
return dat.date().strftime(DEFAULT_SERVER_DATE_FORMAT)
@@ -197,33 +197,37 @@ def make_dtt(days_before, h=0, m=0, to_date=False):
197197
]
198198
)
199199
# Create all leaves on last contract
200-
leaves = cls.env["resource.calendar.leaves"].create(
201-
[
202-
{
203-
"name": "Test Leave 2h",
204-
"date_from": make_dtt(4, h=8, m=0),
205-
"date_to": make_dtt(4, h=8, m=30),
206-
"resource_id": cls.employee.resource_id.id,
207-
"calendar_id": rc_8h_day.id,
208-
"company_id": company.id,
209-
},
210-
{
211-
"name": "Test Leave 4h",
212-
"date_from": make_dtt(3, h=8, m=0),
213-
"date_to": make_dtt(3, h=8, m=30),
214-
"resource_id": cls.employee.resource_id.id,
215-
"calendar_id": rc_8h_day.id,
216-
"company_id": company.id,
217-
},
218-
{
219-
"name": "Test Leave 8h",
220-
"date_from": make_dtt(2, h=8, m=0),
221-
"date_to": make_dtt(2, h=8, m=30),
222-
"resource_id": cls.employee.resource_id.id,
223-
"calendar_id": rc_8h_day.id,
224-
"company_id": company.id,
225-
},
226-
]
200+
leaves = (
201+
cls.env["resource.calendar.leaves"]
202+
.with_context(leave_skip_date_check=True)
203+
.create(
204+
[
205+
{
206+
"name": "Test Leave 2h",
207+
"date_from": make_dtt(4, h=8, m=0),
208+
"date_to": make_dtt(4, h=10, m=0),
209+
"resource_id": cls.employee.resource_id.id,
210+
"calendar_id": rc_8h_day.id,
211+
"company_id": company.id,
212+
},
213+
{
214+
"name": "Test Leave 4h",
215+
"date_from": make_dtt(3, h=10, m=30),
216+
"date_to": make_dtt(3, h=13, m=30),
217+
"resource_id": cls.employee.resource_id.id,
218+
"calendar_id": rc_8h_day.id,
219+
"company_id": company.id,
220+
},
221+
{
222+
"name": "Test Leave 8h",
223+
"date_from": make_dtt(2, h=14, m=0),
224+
"date_to": make_dtt(2, h=22, m=0),
225+
"resource_id": cls.employee.resource_id.id,
226+
"calendar_id": rc_8h_day.id,
227+
"company_id": company.id,
228+
},
229+
]
230+
)
227231
)
228232
# `hr_holidays_attendance` adds extra constrains when considering one
229233
# leave valid for an employee. It wouldn't be a problem, but it's
@@ -263,7 +267,7 @@ def test_overtime(self):
263267
.mapped("duration")
264268
)
265269
# Check Overtime
266-
self.assertEqual(sum(total_overtime), -1.5)
270+
self.assertEqual(sum(total_overtime), 2.5)
267271
# Check Leaves has been moved correctly
268272
for contract in self.contract_history.contract_ids:
269273
self.assertEqual(len(contract.resource_calendar_id.leave_ids), 1)

hr_contract_update_overtime/views/hr_contract_history_view.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
name="action_update_overtime"
1212
string="Update Overtime"
1313
type="object"
14-
groups="hr_attendance.group_hr_attendance_user"
14+
groups="hr_attendance.group_hr_attendance_officer"
1515
help="Update Overtime on Running and Expired contracts"
1616
confirm="This action will also reorganize all the Employee's leaves by distributing them across their contract calendars. If you do not want this to happen, you can Update Overtime from a specific contract."
1717
/>

hr_contract_update_overtime/views/hr_contract_view.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
name="action_update_overtime"
1212
string="Update Overtime"
1313
type="object"
14-
groups="hr_attendance.group_hr_attendance_user"
15-
attrs="{'invisible': [('state', 'not in', ['open', 'close'])]}"
14+
groups="hr_attendance.group_hr_attendance_officer"
15+
invisible="state not in ('open', 'close')"
1616
/>
1717
</xpath>
1818
</field>

0 commit comments

Comments
 (0)