1
votes

I am trying to deactivate user once user is logout from the system.

I am facing the error

You cannot deactivate the user you're currently logged in as.

Is there any way to deactivate the user once user is logout from the system.

1
But why you want to deactivate it i am not getting you case? - Chavada Viki
@VikiChavada I am restrict the user to logout from the system, If user is logout it self, he/she must be re-activate from admin only. - Naitik
What method do you call and where do you call it? It's just a guess but It's probably due to use of "uid" instead of "SUPERUSER_ID". - MICROCOM

1 Answers

1
votes

When your user is logged in and she logs out the function odoo.addons.web.controllers.main.session.logout is invoked. Try overriding that function to perform your change. It should work, use sudo() as well so that you do not get any errors.