Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HR Dashboard check in - Missing Record #116

Open
budu7x opened this issue Apr 12, 2024 · 1 comment
Open

HR Dashboard check in - Missing Record #116

budu7x opened this issue Apr 12, 2024 · 1 comment

Comments

@budu7x
Copy link

budu7x commented Apr 12, 2024

When Administrator user is trying to Check In in the HR Dashboard, gets:

Missing Record

Record does not exist or has been deleted.
(Record: hr.employee(2,), User: 2).

After creating another account, to have user 2. Now, when Administrator(user 1) is checking in, it's showing in the time attendance logs a check in for user 2.

When user 2 to is trying to clock in, returns this:

Missing Record

Record does not exist or has been deleted.
(Record: hr.employee(6,), User: 6)

I tried with a 3rd user and returns this:
Missing Record

Record does not exist or has been deleted.
(Record: hr.employee(7,), User: 7)

All these on Odoo17 with OpenHRMS.

@budu7x
Copy link
Author

budu7x commented Apr 12, 2024

Temporary fix that seems to work:

~/addons/hrms_dashboard/models/hr_employee.py

import pandas as pd
from collections import defaultdict
from datetime import timedelta, datetime, date
from dateutil.relativedelta import relativedelta
from pytz import utc
from odoo import api, fields, models, _
# from odoo.http import request # Removed based on best practices
from odoo.tools import float_utils
import logging  # Added for logging

_logger = logging.getLogger(__name__)  # Added for logging

ROUNDING_FACTOR = 16

class HrEmployee(models.Model):
    """ Inherit hr.employee to add birthday field and custom methods. """
    _inherit = 'hr.employee'

    birthday = fields.Date(string='Date of Birth', groups="base.group_user",
                           help="Birthday")

    def attendance_manual(self):
        _logger.info(f"attendance_manual method called for employee ID: {self.id} - Name: {self.name}")  # Logging the employee
        # The following line is commented out as it's incorrect to use request in the model directly
        # employee = request.env['hr.employee'].sudo().browse(request.session.uid)
        self.sudo()._attendance_action_change({
            'city': _('Unknown'),
            'country_name': _('Unknown'),
            'latitude': False,
            'longitude': False,
            'ip_address': _('Unknown'),
            'browser': _('Unknown'),
            'mode': 'kiosk'
        })
        return self

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant