-
-
Notifications
You must be signed in to change notification settings - Fork 118
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
base: 17.0
Are you sure you want to change the base?
Conversation
|
||
@api.constrains("check_in", "check_out", "employee_id") | ||
def _check_validity(self): | ||
self.employee_id._attendance_ip_check() |
There was a problem hiding this comment.
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 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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): |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
8c1a764
to
554f657
Compare
554f657
to
1e3be03
Compare
No description provided.