You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

52 lines
1.9 KiB

# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Gayathri V (odoo@cybrosys.com)
#
# You can modify it under the terms of the GNU LESSER
# 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.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
############################################################################.
from odoo import fields, models, _
class HrEmployees(models.Model):
"""Inherit the model to add fields and functions"""
_inherit = 'hr.employee.public'
late_check_in_count = fields.Integer(
string="Late Check-In", compute="_compute_late_check_in_count",
help="Count of employee's late checkin")
def action_to_open_late_check_in_records(self):
"""
:return: dictionary defining the action to open the late check-in
records window.
:rtype: dict
"""
return {
'name': _('Employee Late Check-in'),
'domain': [('employee_id', '=', self.id)],
'res_model': 'late.check.in',
'type': 'ir.actions.act_window',
'view_mode': 'list,form',
'limit': 80,
}
def _compute_late_check_in_count(self):
"""Compute the late check-in count"""
for rec in self:
rec.late_check_in_count = self.env['late.check.in'].search_count(
[('employee_id', '=', rec.id)])