Skip to content

Commit

Permalink
[MIG] hr_attendance_modification_tracking: Migration to 18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
HeliconiaSolutions committed Dec 17, 2024
1 parent e8b0595 commit d850668
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 46 deletions.
1 change: 1 addition & 0 deletions hr_attendance_modification_tracking/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ Contributors
- Nagore Salaberria <[email protected]>
- Josean Soroa <[email protected]>
- Aritz Olea <[email protected]>
- ``Heliconia Solutions Pvt. Ltd. <https://www.heliconia.io>``\ \_

Maintainers
-----------
Expand Down
2 changes: 1 addition & 1 deletion hr_attendance_modification_tracking/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"name": "HR Attendance Modification Tracking.",
"summary": """
Attendance changes will now be registered in the chatter.""",
"version": "16.0.1.0.1",
"version": "18.0.1.0.0",
"license": "AGPL-3",
"author": "Creu Blanca, Landoo, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/hr-attendance",
Expand Down
4 changes: 2 additions & 2 deletions hr_attendance_modification_tracking/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).


def pre_init_hook(cr):
cr.execute(
def pre_init_hook(env):
env.cr.execute(
"""
ALTER TABLE hr_attendance
ADD COLUMN IF NOT EXISTS time_changed_manually BOOLEAN
Expand Down
1 change: 1 addition & 0 deletions hr_attendance_modification_tracking/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
- Nagore Salaberria \<<[email protected]>\>
- Josean Soroa \<<[email protected]>\>
- Aritz Olea \<<[email protected]>\>
- `Heliconia Solutions Pvt. Ltd. <https://www.heliconia.io>`_
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ <h2><a class="toc-backref" href="#toc-entry-4">Contributors</a></h2>
<li>Nagore Salaberria &lt;<a class="reference external" href="mailto:ns&#64;landoo.es">ns&#64;landoo.es</a>&gt;</li>
<li>Josean Soroa &lt;<a class="reference external" href="mailto:js&#64;landoo.es">js&#64;landoo.es</a>&gt;</li>
<li>Aritz Olea &lt;<a class="reference external" href="mailto:ao&#64;landoo.es">ao&#64;landoo.es</a>&gt;</li>
<li><tt class="docutils literal">Heliconia Solutions Pvt. Ltd. <span class="pre">&lt;https://www.heliconia.io&gt;</span></tt>_</li>
</ul>
</div>
<div class="section" id="maintainers">
Expand Down
42 changes: 10 additions & 32 deletions hr_attendance_modification_tracking/tests/test_hr_attendance.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,21 @@

from dateutil.relativedelta import relativedelta

from odoo.exceptions import UserError
from odoo.tests.common import TransactionCase
from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT as DF


class TestHrAttendanceTracking(TransactionCase):
def setUp(self):
super().setUp()
self.hr_attendance = self.env["hr.attendance"]
self.employee_01 = self.env["hr.employee"].create({"name": "Employee01"})
self.employee_02 = self.env["hr.employee"].create({"name": "Employee02"})
self.employee_03 = self.env["hr.employee"].create({"name": "Employee03"})
self.employee_04 = self.env["hr.employee"].create({"name": "Employee04"})
self.employee_05 = self.env["hr.employee"].create({"name": "Employee05"})
self.employee_06 = self.env["hr.employee"].create({"name": "Employee06"})
self.employee_07 = self.env["hr.employee"].create({"name": "Employee07"})
dti = datetime.now()
self.att_test = self.hr_attendance.create(
{
"employee_id": self.employee_07.id,
"check_in": dti.strftime(DF),
}
)
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.hr_attendance = cls.env["hr.attendance"]
cls.employee_01 = cls.env["hr.employee"].create({"name": "Employee01"})
cls.employee_02 = cls.env["hr.employee"].create({"name": "Employee02"})
cls.employee_03 = cls.env["hr.employee"].create({"name": "Employee03"})
cls.employee_04 = cls.env["hr.employee"].create({"name": "Employee04"})
cls.employee_05 = cls.env["hr.employee"].create({"name": "Employee05"})
cls.employee_06 = cls.env["hr.employee"].create({"name": "Employee06"})

def test_attendance_edit_01(self):
# We can't check kiosk and check-in/check-out form
Expand Down Expand Up @@ -151,17 +143,3 @@ def test_attendance_edit_07(self):
False,
"Use case 7: Wrong value, time not changed manually.",
)

def test_attendance_edit_08(self):
# Use case 8:
# Trying to create a check-in with an existing one
dti = datetime.now() + relativedelta(minutes=15)
with self.assertRaises(UserError) as e:
self.att_test.create(
{"employee_id": self.employee_07.id, "check_in": dti.strftime(DF)}
)
self.assertEqual(
e.exception.args[0],
"It is not possible to register a new entry because there is already "
"an existing one.",
)
12 changes: 1 addition & 11 deletions hr_attendance_modification_tracking/views/hr_attendance_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,6 @@
<field name="check_out" position="after">
<field name="time_changed_manually" />
</field>
<sheet position="after">
<div class="oe_chatter">
<field
name="message_follower_ids"
widget="mail_followers"
groups="base.group_user"
/>
<field name="message_ids" widget="mail_thread" />
</div>
</sheet>
</field>
</record>
<!-- insert in tree view 'Time Changed' new field -->
Expand Down Expand Up @@ -63,7 +53,7 @@
domain="[('time_changed_manually', '=', True)]"
/>
</filter>
<filter name="groupby_check_out" position="after">
<filter name="groupby_name" position="after">
<field name="time_changed_manually" string="Time Changed" />
<filter
name="group_by_time_changed_manually"
Expand Down

0 comments on commit d850668

Please sign in to comment.