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

[17.0][ADD] hr_attendance_ip_check #168

Open
wants to merge 5 commits into
base: 17.0
Choose a base branch
from

Conversation

sonhd91
Copy link

@sonhd91 sonhd91 commented Jun 27, 2024

No description provided.


@api.constrains("check_in", "check_out", "employee_id")
def _check_validity(self):
self.employee_id._attendance_ip_check()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't self a recordset and therefore you should loop on self?


from odoo import _, exceptions, fields, models
from odoo.http import request

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
from odoo.tools import config


def _attendance_ip_check(self):
"""Return if client ip is not in totp cidrs."""
test_enable = self.env.context.get("test_enable")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
test_enable = self.env.context.get("test_enable")
test_enable = config["test_enable"]

I'm more used to have it from config


attendance_cidr_ids = fields.Many2many("attendance.cidr", ondelete="restrict")

def _attendance_ip_check(self):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When called this method is doing several calls on self but it can be a recordset and will lead to failures

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Branch updated, please check again

@sonhd91 sonhd91 force-pushed the 17.0-mig-hr_attendance_ip_check branch 2 times, most recently from 8c1a764 to 554f657 Compare July 2, 2024 03:53
@sonhd91 sonhd91 force-pushed the 17.0-mig-hr_attendance_ip_check branch from 554f657 to 1e3be03 Compare August 13, 2024 12:45
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

Successfully merging this pull request may close these issues.

3 participants