diff --git a/employee_late_check_in/__init__.py b/employee_late_check_in/__init__.py index 2ad5188e6..de7bbf156 100644 --- a/employee_late_check_in/__init__.py +++ b/employee_late_check_in/__init__.py @@ -20,3 +20,16 @@ # ############################################################################### from . import models +from odoo import SUPERUSER_ID +from odoo.api import Environment + +def post_init_hook(cr, registry): + env = Environment(cr, SUPERUSER_ID, {}) + + cron = env.ref('employee_late_check_in.ir_cron_late_check_in', + raise_if_not_found=False) + if cron: + model = env[cron.model_id.model] + method = getattr(model, 'late_check_in_records', None) + if method: + method() diff --git a/employee_late_check_in/__manifest__.py b/employee_late_check_in/__manifest__.py index 7748631be..222f4a1fd 100644 --- a/employee_late_check_in/__manifest__.py +++ b/employee_late_check_in/__manifest__.py @@ -21,7 +21,7 @@ ############################################################################### { "name": "Employee Late Check-in", - "version": "16.0.1.0.0", + "version": "16.0.1.0.1", "category": "Human Resources", "summary": "Employee Late Check-in module for tracking and managing late " "check-ins of employees and may deduct salary from payslip", @@ -53,4 +53,5 @@ "installable": True, "auto_install": False, "application": False, + "post_init_hook": "post_init_hook" } diff --git a/employee_late_check_in/data/ir_cron_data.xml b/employee_late_check_in/data/ir_cron_data.xml index dbe1f63c5..01812556b 100644 --- a/employee_late_check_in/data/ir_cron_data.xml +++ b/employee_late_check_in/data/ir_cron_data.xml @@ -13,3 +13,5 @@ + + diff --git a/employee_late_check_in/doc/RELEASE_NOTES.md b/employee_late_check_in/doc/RELEASE_NOTES.md index 88002fc2c..ebb728b29 100644 --- a/employee_late_check_in/doc/RELEASE_NOTES.md +++ b/employee_late_check_in/doc/RELEASE_NOTES.md @@ -5,3 +5,8 @@ #### ADD - Initial Commit for Employee Late Check-in + +#### 17.04.2024 +#### Version 16.0.1.0.1 +#### UPDATE + - Updated scheduled action and ensured amount updates in the late-check-in. Displayed time-off when generating payslip and deducted late check in amount from it. diff --git a/employee_late_check_in/models/late_check_in.py b/employee_late_check_in/models/late_check_in.py index 64099a423..376d36ff1 100644 --- a/employee_late_check_in/models/late_check_in.py +++ b/employee_late_check_in/models/late_check_in.py @@ -36,7 +36,7 @@ class LateCheckIn(models.Model): ) late_minutes = fields.Integer( string="Late Minutes", - help="The field indicates the number of " "minutes the worker is late.", + help="The field indicates the number of minutes the worker is late.", ) date = fields.Date(string="Date", help="Current date") penalty_amount = fields.Float( @@ -69,11 +69,11 @@ class LateCheckIn(models.Model): """Compute the penalty amount if the employee was late""" for rec in self: amount = float( - self.env["ir.config_parameter"].sudo().get_param("deduction_amount") + self.env["ir.config_parameter"].sudo().get_param("employee_late_check_in.deduction_amount") ) rec.penalty_amount = amount if ( - self.env["ir.config_parameter"].sudo().get_param("deduction_type") + self.env["ir.config_parameter"].sudo().get_param("employee_late_check_in.deduction_type") == "minutes" ): rec.penalty_amount = amount * rec.late_minutes diff --git a/employee_late_check_in/views/late_check_in_views.xml b/employee_late_check_in/views/late_check_in_views.xml index 2b2b8fde8..1188b0f80 100644 --- a/employee_late_check_in/views/late_check_in_views.xml +++ b/employee_late_check_in/views/late_check_in_views.xml @@ -74,6 +74,7 @@ +