Browse Source

Aug 14: [FIX] Bug Fixed 'employee_late_check_in'

pull/331/head
Cybrosys Technologies 9 months ago
parent
commit
2836c65a6f
  1. 2
      employee_late_check_in/README.rst
  2. 0
      employee_late_check_in/__init__.py
  3. 1
      employee_late_check_in/__manifest__.py
  4. 0
      employee_late_check_in/data/ir_cron_data.xml
  5. 0
      employee_late_check_in/data/salary_rule.xml
  6. 7
      employee_late_check_in/doc/RELEASE_NOTES.md
  7. 0
      employee_late_check_in/models/__init__.py
  8. 32
      employee_late_check_in/models/hr_attendance.py
  9. 2
      employee_late_check_in/models/hr_employee.py
  10. 2
      employee_late_check_in/models/hr_employees_public.py
  11. 2
      employee_late_check_in/models/hr_payslip.py
  12. 0
      employee_late_check_in/models/late_check_in.py
  13. 2
      employee_late_check_in/models/res_company.py
  14. 4
      employee_late_check_in/models/res_config_settings.py
  15. 0
      employee_late_check_in/security/ir.model.access.csv
  16. 9
      employee_late_check_in/static/description/index.html
  17. 0
      employee_late_check_in/views/hr_attendance_views.xml
  18. 0
      employee_late_check_in/views/hr_employee_views.xml
  19. 0
      employee_late_check_in/views/hr_payslip_views.xml
  20. 4
      employee_late_check_in/views/late_check_in_views.xml
  21. 15
      employee_late_check_in/views/res_config_settings_views.xml

2
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 :target: https://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3 :alt: License: LGPL-3

0
employee_late_check_in/__init__.py

1
employee_late_check_in/__manifest__.py

@ -10,6 +10,7 @@
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. # GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. # GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.

0
employee_late_check_in/data/ir_cron_data.xml

0
employee_late_check_in/data/salary_rule.xml

7
employee_late_check_in/doc/RELEASE_NOTES.md

@ -5,3 +5,10 @@
#### ADD #### ADD
- Initial Commit for Employee Late Check-in - Initial Commit for Employee Late Check-in
#### 12.08.2024
#### Version 17.0.1.0.1
#### ADD
- Bug Fix for Employee Late Check-in

0
employee_late_check_in/models/__init__.py

32
employee_late_check_in/models/hr_attendance.py

@ -21,7 +21,7 @@
############################################################################. ############################################################################.
import pytz import pytz
from datetime import datetime, timedelta from datetime import datetime, timedelta
from odoo import fields, models from odoo import fields, models, api
class HrAttendance(models.Model): class HrAttendance(models.Model):
@ -30,8 +30,10 @@ class HrAttendance(models.Model):
late_check_in = fields.Integer( late_check_in = fields.Integer(
string="Late Check-in(Minutes)", compute="_compute_late_check_in", 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): def _compute_late_check_in(self):
"""Calculate late check-in minutes for each record in the current Odoo """Calculate late check-in minutes for each record in the current Odoo
model.This method iterates through the records and calculates late model.This method iterates through the records and calculates late
@ -71,14 +73,28 @@ class HrAttendance(models.Model):
'late_check_in_after')) or 0 'late_check_in_after')) or 0
max_limit = int(self.env['ir.config_parameter'].sudo().get_param( max_limit = int(self.env['ir.config_parameter'].sudo().get_param(
'maximum_minutes')) or 0 'maximum_minutes')) or 0
for rec in self.sudo().search( for rec in self.sudo().search([]):
[('id', 'not in', self.env['late.check.in'].sudo().search( if rec.id not in self.env['late.check.in'].sudo().search(
[]).attendance_id.ids)]): []).attendance_id.ids:
late_check_in = rec.sudo().late_check_in + 210 if rec.late_check_in > minutes_after and minutes_after < rec.late_check_in < max_limit:
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({ self.env['late.check.in'].sudo().create({
'employee_id': rec.employee_id.id, 'employee_id': rec.employee_id.id,
'late_minutes': late_check_in, 'late_minutes': rec.late_check_in,
'date': rec.check_in.date(), 'date': rec.check_in.date(),
'attendance_id': rec.id, '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()

2
employee_late_check_in/models/hr_employee.py

@ -19,7 +19,7 @@
# If not, see <http://www.gnu.org/licenses/>. # If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################. ############################################################################.
from odoo import fields, models, _ from odoo import fields, models,_
class HrEmployee(models.Model): class HrEmployee(models.Model):

2
employee_late_check_in/models/hr_employees_public.py

@ -19,7 +19,7 @@
# If not, see <http://www.gnu.org/licenses/>. # If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################. ############################################################################.
from odoo import fields, models, _ from odoo import fields, models,_
class HrEmployees(models.Model): class HrEmployees(models.Model):

2
employee_late_check_in/models/hr_payslip.py

@ -47,7 +47,7 @@ class PayslipLateCheckIn(models.Model):
input_data = { input_data = {
'name': late_check_in_type.name, 'name': late_check_in_type.name,
'code': late_check_in_type.code, '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, 'contract_id': self.contract_id.id,
} }
res.append(input_data) res.append(input_data)

0
employee_late_check_in/models/late_check_in.py

2
employee_late_check_in/models/res_company.py

@ -19,7 +19,7 @@
# If not, see <http://www.gnu.org/licenses/>. # If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################. ############################################################################.
from odoo import models, fields from odoo import fields, models
class ResCompany(models.Model): class ResCompany(models.Model):

4
employee_late_check_in/models/res_config_settings.py

@ -19,7 +19,7 @@
# If not, see <http://www.gnu.org/licenses/>. # If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################. ############################################################################.
from odoo import models, fields from odoo import fields, models
class LateCheckinSettings(models.TransientModel): class LateCheckinSettings(models.TransientModel):
@ -33,7 +33,7 @@ class LateCheckinSettings(models.TransientModel):
maximum_minutes = fields.Char( maximum_minutes = fields.Char(
config_parameter='employee_late_check_in.maximum_minutes', config_parameter='employee_late_check_in.maximum_minutes',
help="Maximum time limit a employee was considered as late", 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( late_check_in_after = fields.Char(
config_parameter='employee_late_check_in.late_check_in_after', config_parameter='employee_late_check_in.late_check_in_after',
help='When should the late check-in count down starts.', help='When should the late check-in count down starts.',

0
employee_late_check_in/security/ir.model.access.csv

9
employee_late_check_in/static/description/index.html

@ -270,6 +270,15 @@
<p class="m-0" <p class="m-0"
style=" color:#718096!important; font-size:1rem !important;line-height: 28px;"> style=" color:#718096!important; font-size:1rem !important;line-height: 28px;">
Initial Commit for Employee Late Check-in.</p> Initial Commit for Employee Late Check-in.</p>
<div class="d-flex mb-3"
style="font-size: 0.8rem; font-weight: 500;"><span>Version
17.0.1.0.1</span><span
class="px-2">|</span><span
style="color: #714B67;font-weight: 600;">Released on:12th August 2024</span>
</div>
<p class="m-0"
style=" color:#718096!important; font-size:1rem !important;line-height: 28px;">
Bug fixes for Employee Late Check-in.</p>
</div> </div>
</div> </div>
</div> </div>

0
employee_late_check_in/views/hr_attendance_views.xml

0
employee_late_check_in/views/hr_employee_views.xml

0
employee_late_check_in/views/hr_payslip_views.xml

4
employee_late_check_in/views/late_check_in_views.xml

@ -20,10 +20,10 @@
<field name="state" widget="statusbar" <field name="state" widget="statusbar"
statusbar_visible="draft,approved"/> statusbar_visible="draft,approved"/>
<button name="approve" string="Approve" <button name="approve" string="Approve"
type="object" class="btn-primary" type="object" class="btn-primary" invisible="state != 'draft'"
groups="hr.group_hr_manager"/> groups="hr.group_hr_manager"/>
<button name="reject" string="Refuse" type="object" <button name="reject" string="Refuse" type="object"
class="btn-primary" class="btn-primary" invisible="state != 'draft'"
groups="hr.group_hr_manager"/> groups="hr.group_hr_manager"/>
</header> </header>
<sheet> <sheet>

15
employee_late_check_in/views/res_config_settings_views.xml

@ -2,7 +2,9 @@
<odoo> <odoo>
Adding fields in res.config.settings Adding fields in res.config.settings
<record id="res_config_settings_view_form" model="ir.ui.view"> <record id="res_config_settings_view_form" model="ir.ui.view">
<field name="name">res.config.settings.view.form.inherit.employee.late.check.in</field> <field name="name">
res.config.settings.view.form.inherit.employee.late.check.in
</field>
<field name="model">res.config.settings</field> <field name="model">res.config.settings</field>
<field name="inherit_id" <field name="inherit_id"
ref="hr_attendance.res_config_settings_view_form"/> ref="hr_attendance.res_config_settings_view_form"/>
@ -20,11 +22,16 @@
</setting> </setting>
<setting id="late_check_in_after" company_dependent="1" <setting id="late_check_in_after" company_dependent="1"
help="When should the late check-in count down starts."> help="When should the late check-in count down starts.">
<field name="late_check_in_after"/><span>Minutes</span> <field name="late_check_in_after"/>
<span>Minutes</span>
</setting> </setting>
<setting id="maximum_minutes" company_dependent="1" <setting id="maximum_minutes" company_dependent="1"
help="Maximum time limit a employee was considered as late."> help=" Specifies the maximum threshold for recording late check-ins.
<field name="maximum_minutes"/><span>Minutes</span> (Enter the number of minutes after which a check-in is treated as an absence or another type of leave,etc.
For example, if set to 100, a check-in that is 99 minutes late will be recorded as a late check-in, but a check-in that is 101 minutes late will not be recorded as a late check-in.)
">
<field name="maximum_minutes"/>
<span>Minutes</span>
</setting> </setting>
</block> </block>
</xpath> </xpath>

Loading…
Cancel
Save