Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
How to implement automatically signout in odoo 8 or openerp 7 human resource module , if the PC is idle(or sleep) condition
I want to implement automatically signout feature from HR module in odoo 8 or openerp 7 version.
Currently the attendance system shows last sign in message and click for signout and sign in alert .But I want to do signout steps automatically ,if the user is in idle(sleep ,based on our PC) condition for a particular time period.How can I achievee this task?
Signout or Logout, a little bit confused: login (logon) and logout (logoff) or sign in sign out ...... OpenERP Session or HR Time and Attendance !!! ???
In your question you are talking about 2 different things: OpenERP automatic Logout from session (based on timeout) and HR Attendance Signout.
For the first case, if you just want to log out user (ending his session): edit the file ../addons/web/http.py at line 450 (last_week = time.time() - 60*60*24*7), and replace 60*60*24*24*7 by the value you want (Idle Time = Timeout - in seconds ) (e.g for 15 minutes = 60*15, for one day = 60*60*24, for 2 days = 60*60*24*2 ...). And restart the server if needed.
For the second case, just post another question, describing what you really want.
And if you want to implement an automatic sign out solution for Time tracking in HR Attendance (an employee forgot to sign out ...) just take a look to the code in this module (or use it as it is).
Important Remark: When a user is Login out from his session this not mean that he Signed out for the Day in Attendance.
Very complicated solution, you are putting the bar very high !!!
In fact you need a mix of the both cases, maybe this can simply done by executing the hr_sign_out_forgotten_solve when removing session (i mean calling the function hr_sign_out_forgotten_solve in the removed_sessions) BUT HOW ???And this implies that the employee is already in Sign in State.
the same function is available in odoo 8. The only difference is that the http.py file is located at the root of odoo directory and not in addons/web . One more thing. If you server doesnt have a heavy request, it could be better for you to increase the top limit of the random value : for example
if random.random() < 0.1:
This is valid for session timeout from the server and not from HR module
To automaticaly sign out of HR attendance, this is one of the steps you can do:
1. Create a module that depends on hr.attendance
2. inherit the hr.employee class
3. define a function that you can call in an action. this function is in the new hr_employe class you created
4. Inside the function, for each employee (hr.employee) define a routine to check if the session is active for the user (res.user) related to the employee (it can be similar to the function in http.py session_gc(session_store) without the random ). dont forget to import packages like os, sys
5. When the user has no active session, if employee.state=='present', call attendance_action_change(cr, employee.id, , context=None) . This function is already defined in the hr.employee under hr.attendance module
6. Create an action that you can call, lets say every 5 min. Bind it on the hr.employee object with the function you created on step 3
About This Community
This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 11/17/14, 3:50 AM|
|Seen: 4108 times|
|Last updated: 8/4/15, 11:40 AM|