from odoo import fields, models class HREmployee(models.Model): _inherit = 'hr.employee' attendance_analytics_count = fields.Integer( string="Attendance Count", compute="_compute_attendance_analytics_count" ) attendance_mode = fields.Selection( [ ('office', 'Office'), ('remote', 'Remote'), ('hybrid', 'Hybrid'), ('shift', 'Shift Based'), ], string='Attendance Mode', default='office', tracking=True, ) work_mode = fields.Selection([ ('office', 'Office'), ('wfh', 'Work From Home'), ], default='office') def _compute_attendance_analytics_count(self): analytics = self.env['attendance.analytics'] for rec in self: rec.attendance_analytics_count = analytics.search_count([ ('employee_id', '=', rec.id) ]) def action_open_attendance_analytics(self): self.ensure_one() return { 'type': 'ir.actions.act_window', 'name': 'Attendance Sheet', 'res_model': 'attendance.analytics', 'view_mode': 'list,pivot,graph', 'domain': [('employee_id', '=', self.id)], 'context': { 'search_default_employee_id': self.id } }