Odoo Help

Welcome!

This community 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.

0

How to implement automatically signout in odoo 8 or openerp 7 human resource module , if the PC is idle(or sleep) condition

By
Odoo
on 11/17/14, 3:50 AM 3,857 views

Hi all,

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? 

0

Grover Menacho

--Grover Menacho--
2523
| 5 7 8
La Paz, Bolivia
--Grover Menacho--

Systems Engineer + MBA

Grover Menacho
On 8/4/15, 11:39 AM

You can install the community addon: Idle Logout

Hi..Appreciate for your response.But actual requirement is related to HR Employees ,not for users in odoo.. I can easily customize users Logout by http.py file.But my question is related to hr employees sign out if the PC is idle some time...Please replay for this question..

Odoo
on 8/4/15, 1:38 PM
0

Med Said BARA

--Med Said BARA--
2664
| 5 5 7
Algeria
--Med Said BARA--
Med Said BARA
On 11/18/14, 8:41 PM

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.

Yes I need the second case HR Attendance Signout(should automatically signout if the system is idle after some time ,not about session expiring),I dont want to openerp session time out .

Odoo
on 11/20/14, 9:39 AM

Very complicated solution, you are putting the bar very high !!!

Med Said BARA
on 11/20/14, 10:43 AM

It's a "Google" translation from French "Mettre la barre très haut", which means the question is reaching a High Level of difficulties and need more skills (Nothing bad)

Med Said BARA
on 11/20/14, 11:13 AM
0
Tharcisse Mukundayi
On 4/9/15, 11:41 AM


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



Then how to implement this in odoo 8,Can you explain step by step

Odoo
on 4/9/15, 12:43 PM

You mean for the HR attendance Signout? If yes then one of the things to to could be 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 employe define a routine to check if the session is active for a user (it can be similar to the function in http.py session_gc(session_store) without the random ) 5. When the session is not active, if employee.state=='present', call attendance_action_change(cr, employee.id, [], context=None) . This function is 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

Tharcisse Mukundayi
on 4/9/15, 1:39 PM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

4 follower(s)

Stats

Asked: 11/17/14, 3:50 AM
Seen: 3857 times
Last updated: 8/4/15, 11:40 AM