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 . # ############################################################################. -from odoo import fields, models, _ +from odoo import fields, models,_ class HrEmployee(models.Model): diff --git a/employee_late_check_in/models/hr_employees_public.py b/employee_late_check_in/models/hr_employees_public.py old mode 100644 new mode 100755 index 652c39b90..587d5808a --- a/employee_late_check_in/models/hr_employees_public.py +++ b/employee_late_check_in/models/hr_employees_public.py @@ -19,7 +19,7 @@ # If not, see . # ############################################################################. -from odoo import fields, models, _ +from odoo import fields, models,_ class HrEmployees(models.Model): diff --git a/employee_late_check_in/models/hr_payslip.py b/employee_late_check_in/models/hr_payslip.py old mode 100644 new mode 100755 index 6a30a06ee..48a1f49f9 --- a/employee_late_check_in/models/hr_payslip.py +++ b/employee_late_check_in/models/hr_payslip.py @@ -47,7 +47,7 @@ class PayslipLateCheckIn(models.Model): input_data = { 'name': late_check_in_type.name, 'code': late_check_in_type.code, - 'amount': sum(late_check_in_id.mapped('amount')), + 'amount': sum(late_check_in_id.mapped('penalty_amount')), 'contract_id': self.contract_id.id, } res.append(input_data) diff --git a/employee_late_check_in/models/late_check_in.py b/employee_late_check_in/models/late_check_in.py old mode 100644 new mode 100755 diff --git a/employee_late_check_in/models/res_company.py b/employee_late_check_in/models/res_company.py old mode 100644 new mode 100755 index 9feff1632..463bc863b --- a/employee_late_check_in/models/res_company.py +++ b/employee_late_check_in/models/res_company.py @@ -19,7 +19,7 @@ # If not, see . # ############################################################################. -from odoo import models, fields +from odoo import fields, models class ResCompany(models.Model): diff --git a/employee_late_check_in/models/res_config_settings.py b/employee_late_check_in/models/res_config_settings.py old mode 100644 new mode 100755 index c7d2c1bd4..cea955a25 --- a/employee_late_check_in/models/res_config_settings.py +++ b/employee_late_check_in/models/res_config_settings.py @@ -19,7 +19,7 @@ # If not, see . # ############################################################################. -from odoo import models, fields +from odoo import fields, models class LateCheckinSettings(models.TransientModel): @@ -33,7 +33,7 @@ class LateCheckinSettings(models.TransientModel): maximum_minutes = fields.Char( config_parameter='employee_late_check_in.maximum_minutes', help="Maximum time limit a employee was considered as late", - string="Maximum Late Minute") + string="Maximum Late Minute",default="240") late_check_in_after = fields.Char( config_parameter='employee_late_check_in.late_check_in_after', help='When should the late check-in count down starts.', diff --git a/employee_late_check_in/security/ir.model.access.csv b/employee_late_check_in/security/ir.model.access.csv old mode 100644 new mode 100755 diff --git a/employee_late_check_in/static/description/index.html b/employee_late_check_in/static/description/index.html index 48dcc037c..33e9815df 100644 --- a/employee_late_check_in/static/description/index.html +++ b/employee_late_check_in/static/description/index.html @@ -270,6 +270,15 @@

Initial Commit for Employee Late Check-in.

+
Version + 17.0.1.0.1|Released on:12th August 2024 +
+

+ 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 @@