Ir al contenido
Odoo Menú
  • Identificarse
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • TPV para tiendas
    • TPV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en directo
    • eLearning
    Cadena de suministro
    • Inventario
    • Fabricación
    • PLM
    • Compra
    • Mantenimiento
    • Calidad
    Recursos Humanos
    • Empleados
    • Reclutamiento
    • Ausencias
    • Evaluación
    • Referencias
    • Flota
    Marketing
    • Marketing social
    • Marketing por correo electrónico
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyecto
    • Partes de horas
    • Servicio de campo
    • Servicio de asistencia
    • Planificación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Información
    • WhatsApp
    Aplicaciones de terceros Studio de Odoo Plataforma de Odoo Cloud
  • Industrias
    Comercio al por menor
    • Librería
    • Tienda de ropa
    • Tienda de muebles
    • Tienda de ultramarinos
    • Ferretería
    • Juguetería
    Alimentación y hostelería
    • Bar y taberna
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidor de bebidas
    • Hotel
    Inmueble
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión inmobiliaria
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Empresa contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Fabricación
    • Textil
    • Metal
    • Muebles
    • Alimentos
    • Brewery
    • Regalos de empresas
    Salud y bienestar
    • Club deportivo
    • Óptica
    • Gimnasio
    • Terapeutas
    • Farmacia
    • Peluquería
    Oficios
    • Handyman
    • Hardware y asistencia informática
    • Sistemas de energía solar
    • Zapatero
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin ánimo de lucro
    • Agencia de protección del medio ambiente
    • Alquiler de paneles publicitarios
    • Estudio fotográfico
    • Alquiler de bicicletas
    • Distribuidor de software
    Browse all Industries
  • Comunidad
    Aprender
    • Tutoriales
    • Documentación
    • Certificaciones
    • Formación
    • Blog
    • Podcast
    Potenciar la educación
    • Programa de formación
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtener el software
    • Descargar
    • Comparar ediciones
    • Versiones
    Colaborar
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Convertirse en partner
    • Services for Partners
    • Registrar tu empresa contable
    Obtener servicios
    • Encontrar un partner
    • Encontrar un asesor fiscal
    • Contacta con un experto
    • Servicios de implementación
    • Referencias de clientes
    • Ayuda
    • Actualizaciones
    GitHub YouTube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicitar una demostración
  • Precios
  • Ayuda

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Contabilidad
  • Inventario
  • PoS
  • Proyecto
  • MRP
All apps
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Ayuda

Log out session Odoo 17

Suscribirse

Reciba una notificación cuando haya actividad en esta publicación

Se marcó esta pregunta
communitypythonodoo17
2 Respuestas
3374 Vistas
Avatar
user

Hi,

I need to log out my session on a specific time, how i do that? i did but i get an error, how i solve this? I created a scheduled action for this. I found out the problem is that, we can't use the http.request in the cron job. So what method i can use in this to logout the session on a specific time?


@api.model
def logout_users_at_midnight(self):
users = self.sudo().search([('active', '=', True)])
for user in users:
user_timezone = pytz.timezone(user.tz or 'UTC')
current_time = datetime.now(user_timezone)
if current_time.hour == 5 and current_time.minute == 35:
self.logout_user(user)

def logout_user(self, user):
if request.session:
request.session.logout()
By using this code, i get an error,
raise RuntimeError("object unbound")
RuntimeError: object unbound

raise ValueError('%s: "%s" while evaluating\n%r' % (ustr(type(e)), ustr(e), expr))
ValueError: <class 'RuntimeError'>: "object unbound" while evaluating
'model.logout_users_at_midnight()'

During handling of the above exception, another exception occurred:

0
Avatar
Descartar
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Mejor respuesta

Hi,

Please refer to the module:

https://apps.odoo.com/apps/modules/17.0/auto_logout_idle_user_odoo

You can find the latest version from V14 to V18.


Hope it helps.

0
Avatar
Descartar
Avatar
Ritik (Wan Buffer Services)
Mejor respuesta

Implementing a scheduled user logout in Odoo 17 can enhance security and ensure compliance with organizational policies. The approach involves creating a scheduled action that logs out users at a specified time. However, as you've encountered errors with your current implementation, here's a refined method to achieve this:​

1. Utilize the auth_session_timeout Module:

The Inactive Sessions Timeout module, developed by the Odoo Community Association (OCA), allows administrators to define a timeout for inactive sessions. This module can be configured to log out users after a specified period of inactivity. You can set the session validity duration by adjusting the inactive_session_time_out_delay parameter, which defines the session validity in seconds (default is 2 hours). ​

2. Implement Custom Scheduled Actions:

If a specific logout time is required (e.g., midnight), you can create a scheduled action within Odoo:​

  • Define the Scheduled Action:
    • Navigate to Settings > Technical > Automation > Scheduled Actions.​
    • Create a new scheduled action that calls a custom method to terminate user sessions at the desired time.​
  • Develop the Custom Method:
    • Create a method in a custom module that identifies active sessions and terminates them.​
    • Ensure proper handling of session termination to avoid errors and ensure system stability.​

3. Addressing Implementation Errors:

Errors in scheduled actions can arise from various factors, including incorrect method definitions or access rights issues. It's crucial to review the error logs to identify the specific cause. Ensuring that the method has the necessary permissions and correctly interacts with the session management system is vital.​

At Wan Buffer Services, we specialize in customizing Odoo functionalities to align with organizational requirements. Implementing scheduled user logouts can be tailored to your specific needs, ensuring both security and compliance.

0
Avatar
Descartar
¿Le interesa esta conversación? ¡Participe en ella!

Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.

Inscribirse
Publicaciones relacionadas Respuestas Vistas Actividad
Request for Compatible Low Stock Alerts Module for Odoo 17.0-20240718 Community Edition
community models odoo17
Avatar
Avatar
Avatar
2
jun 25
2097
Error Report: Odoo 17 Installation Issue
python postgresql odoo17
Avatar
0
ago 24
2663
Issue with Access Rules for Attachments / odoo 17 Resuelto
security python xml odoo17
Avatar
Avatar
Avatar
Avatar
Avatar
4
jun 25
4041
Foreign Key Constraint Error When Closing POS Session in Odoo 17 Community
accounting community pos odoo17
Avatar
0
mar 25
2017
settings multi company
settings python multicompany odoo17
Avatar
0
may 24
2186
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento Odoo.sh
  • Ayuda
  • Actualizar
  • Desarrollos personalizados
  • Educación
  • Encontrar un asesor fiscal
  • Encontrar un partner
  • Convertirse en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contacta con nosotros
  • Puestos de trabajo
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Información legal • Privacidad
  • Seguridad
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo es un conjunto de aplicaciones de código abierto que cubren todas las necesidades de tu empresa: CRM, comercio electrónico, contabilidad, inventario, punto de venta, gestión de proyectos, etc.

La propuesta única de valor de Odoo es ser muy fácil de usar y totalmente integrado.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now