# -*- coding: utf-8 -*- ################################################################################### # # Cybrosys Technologies Pvt. Ltd. # # Copyright (C) 2020-TODAY Cybrosys Technologies (). # Author: Ijaz Ahammed (odoo@cybrosys.com) # # This program is free software: you can modify # it under the terms of the GNU Affero General Public License (AGPL) as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # 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 Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . # ################################################################################### from odoo import models, fields, _ class HrEmployee(models.Model): _inherit = 'hr.employee' late_check_in_count = fields.Integer(string="Late Check-In", compute="get_late_check_in_count") def action_to_open_late_check_in_records(self): domain = [ ('employee_id', '=', self.id), ] return { 'name': _('Employee Late Check-in'), 'domain': domain, 'res_model': 'late.check_in', 'type': 'ir.actions.act_window', 'view_mode': 'tree,form', 'limit': 80, } def get_late_check_in_count(self): self.late_check_in_count = self.env['late.check_in'].search_count([('employee_id', '=', self.id)]) class HrEmployees(models.Model): _inherit = 'hr.employee.public' late_check_in_count = fields.Integer(string="Late Check-In", compute="get_late_check_in_count") def action_to_open_late_check_in_records(self): domain = [ ('employee_id', '=', self.id), ] return { 'name': _('Employee Late Check-in'), 'domain': domain, 'res_model': 'late.check_in', 'type': 'ir.actions.act_window', 'view_mode': 'tree,form', 'limit': 80, } def get_late_check_in_count(self): self.late_check_in_count = self.env['late.check_in'].search_count([('employee_id', '=', self.id)])