<form>
<button name="recognize_face" string="Get your Attendance" type="object"/>
<newline />
<button name="action_initialize_face" string="Initialize Your Face" type="object"/>
</form>
I can’t seem to get this two do their action, is this something wrong?
def action_initialize_face(self):
# Check user permission (optional)
user_id = self.context.get('user')
if not user_id:
raise UserError('User context is not available.')
# Open the web application for face recognition initialization
for record in self:
url = (f"http://localhost:8080/initialize-face?"
f"employee_id={record.id}")
webbrowser.open(url)
def action_open_webapp(self):
# Check user permission (optional)
user_id = self.context.get('user')
if not user_id:
raise UserError('User context is not available.')
# Open the web application with parameters
for record in self:
url = (f"http://localhost:8080/face-recognition?"
f"employee_id={record.id}&"
f"face_id={record.face_recognition_id}")
webbrowser.open(url)
This what happens in tryton: