diff --git a/employee_late_check_in/README.rst b/employee_late_check_in/README.rst
old mode 100644
new mode 100755
index 31030480a..b03d06249
--- a/employee_late_check_in/README.rst
+++ b/employee_late_check_in/README.rst
@@ -1,4 +1,4 @@
-.. image:: https://img.shields.io/badge/licence-LGPL--3-blue.svg
+.. image:: https://img.shields.io/badge/license-LGPL--3-blue.svg
:target: https://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
diff --git a/employee_late_check_in/__init__.py b/employee_late_check_in/__init__.py
old mode 100644
new mode 100755
diff --git a/employee_late_check_in/__manifest__.py b/employee_late_check_in/__manifest__.py
old mode 100644
new mode 100755
index dccaa8e32..f7b6b3865
--- a/employee_late_check_in/__manifest__.py
+++ b/employee_late_check_in/__manifest__.py
@@ -10,6 +10,7 @@
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# This program is distributed in the hope that it will be useful,
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
diff --git a/employee_late_check_in/data/ir_cron_data.xml b/employee_late_check_in/data/ir_cron_data.xml
old mode 100644
new mode 100755
diff --git a/employee_late_check_in/data/salary_rule.xml b/employee_late_check_in/data/salary_rule.xml
old mode 100644
new mode 100755
diff --git a/employee_late_check_in/doc/RELEASE_NOTES.md b/employee_late_check_in/doc/RELEASE_NOTES.md
old mode 100644
new mode 100755
index a33e61db3..1f6e86beb
--- a/employee_late_check_in/doc/RELEASE_NOTES.md
+++ b/employee_late_check_in/doc/RELEASE_NOTES.md
@@ -5,3 +5,10 @@
#### ADD
- Initial Commit for Employee Late Check-in
+
+#### 12.08.2024
+#### Version 17.0.1.0.1
+#### ADD
+
+- Bug Fix for Employee Late Check-in
+
diff --git a/employee_late_check_in/models/__init__.py b/employee_late_check_in/models/__init__.py
old mode 100644
new mode 100755
diff --git a/employee_late_check_in/models/hr_attendance.py b/employee_late_check_in/models/hr_attendance.py
old mode 100644
new mode 100755
index 2e9a17793..68b09822e
--- a/employee_late_check_in/models/hr_attendance.py
+++ b/employee_late_check_in/models/hr_attendance.py
@@ -21,7 +21,7 @@
############################################################################.
import pytz
from datetime import datetime, timedelta
-from odoo import fields, models
+from odoo import fields, models, api
class HrAttendance(models.Model):
@@ -30,8 +30,10 @@ class HrAttendance(models.Model):
late_check_in = fields.Integer(
string="Late Check-in(Minutes)", compute="_compute_late_check_in",
- help="This indicates the duration of the employee's tardiness.")
+ help="This indicates the duration of the employee's tardiness.",
+ store=True)
+ @api.depends('check_in')
def _compute_late_check_in(self):
"""Calculate late check-in minutes for each record in the current Odoo
model.This method iterates through the records and calculates late
@@ -71,14 +73,28 @@ class HrAttendance(models.Model):
'late_check_in_after')) or 0
max_limit = int(self.env['ir.config_parameter'].sudo().get_param(
'maximum_minutes')) or 0
- for rec in self.sudo().search(
- [('id', 'not in', self.env['late.check.in'].sudo().search(
- []).attendance_id.ids)]):
- late_check_in = rec.sudo().late_check_in + 210
- if rec.late_check_in > minutes_after and late_check_in > minutes_after and late_check_in < max_limit:
- self.env['late.check.in'].sudo().create({
- 'employee_id': rec.employee_id.id,
- 'late_minutes': late_check_in,
+ for rec in self.sudo().search([]):
+ if rec.id not in self.env['late.check.in'].sudo().search(
+ []).attendance_id.ids:
+ if rec.late_check_in > minutes_after and minutes_after < rec.late_check_in < max_limit:
+ self.env['late.check.in'].sudo().create({
+ 'employee_id': rec.employee_id.id,
+ 'late_minutes': rec.late_check_in,
+ 'date': rec.check_in.date(),
+ 'attendance_id': rec.id,
+ })
+ else:
+ self.env['late.check.in'].sudo().search(
+ [('attendance_id', '=', rec.id)]).update({
+ 'late_minutes': rec.late_check_in,
'date': rec.check_in.date(),
'attendance_id': rec.id,
})
+
+ def unlink(self):
+ """Override the unlink method to delete the corresponding records in
+ late.check.in model"""
+ for record in self:
+ self.env['late.check.in'].sudo().search(
+ [('attendance_id', '=', record.id)]).unlink()
+ return super(HrAttendance, self).unlink()
diff --git a/employee_late_check_in/models/hr_employee.py b/employee_late_check_in/models/hr_employee.py
old mode 100644
new mode 100755
index be369880f..063b2f677
--- a/employee_late_check_in/models/hr_employee.py
+++ b/employee_late_check_in/models/hr_employee.py
@@ -19,7 +19,7 @@
# If not, see
Initial Commit for Employee Late Check-in.
++ Bug fixes for Employee Late Check-in.
diff --git a/employee_late_check_in/views/hr_attendance_views.xml b/employee_late_check_in/views/hr_attendance_views.xml old mode 100644 new mode 100755 diff --git a/employee_late_check_in/views/hr_employee_views.xml b/employee_late_check_in/views/hr_employee_views.xml old mode 100644 new mode 100755 diff --git a/employee_late_check_in/views/hr_payslip_views.xml b/employee_late_check_in/views/hr_payslip_views.xml old mode 100644 new mode 100755 diff --git a/employee_late_check_in/views/late_check_in_views.xml b/employee_late_check_in/views/late_check_in_views.xml old mode 100644 new mode 100755 index ddf49270e..f225f9d44 --- a/employee_late_check_in/views/late_check_in_views.xml +++ b/employee_late_check_in/views/late_check_in_views.xml @@ -20,10 +20,10 @@