Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Magazin de îmbrăcăminte
    • Magazin de Mobilă
    • Magazin alimentar
    • Magazin de materiale de construcții
    • Magazin de jucării
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Distribuitor de băuturi
    • Hotel
    Proprietate imobiliara
    • Real Estate Agency
    • Firmă de Arhitectură
    • Construcție
    • Estate Managament
    • Grădinărit
    • Asociația Proprietarilor de Proprietăți
    Consultanta
    • Firma de Contabilitate
    • Partener Odoo
    • Agenție de marketing
    • Law firm
    • Atragere de talente
    • Audit & Certification
    Producție
    • Textil
    • Metal
    • Mobilier
    • Mâncare
    • Brewery
    • Cadouri corporate
    Health & Fitness
    • Club Sportiv
    • Magazin de ochelari
    • Centru de Fitness
    • Wellness Practitioners
    • Farmacie
    • Salon de coafură
    Trades
    • Handyman
    • IT Hardware and Support
    • Asigurare socială de stat
    • Cizmar
    • Servicii de curățenie
    • HVAC Services
    Altele
    • Organizație nonprofit
    • Agenție de Mediu
    • Închiriere panouri publicitare
    • Fotografie
    • Închiriere biciclete
    • Asigurare socială
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

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

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

Log out session Odoo 17

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
communitypythonodoo17
2 Răspunsuri
3370 Vizualizări
Imagine profil
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
Imagine profil
Abandonează
Imagine profil
Cybrosys Techno Solutions Pvt.Ltd
Cel mai bun răspuns

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
Imagine profil
Abandonează
Imagine profil
Ritik (Wan Buffer Services)
Cel mai bun răspuns

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
Imagine profil
Abandonează
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Înscrie-te
Related Posts Răspunsuri Vizualizări Activitate
Request for Compatible Low Stock Alerts Module for Odoo 17.0-20240718 Community Edition
community models odoo17
Imagine profil
Imagine profil
Imagine profil
2
iun. 25
2096
Error Report: Odoo 17 Installation Issue
python postgresql odoo17
Imagine profil
0
aug. 24
2662
Issue with Access Rules for Attachments / odoo 17 Rezolvat
security python xml odoo17
Imagine profil
Imagine profil
Imagine profil
Imagine profil
Imagine profil
4
iun. 25
4037
Foreign Key Constraint Error When Closing POS Session in Odoo 17 Community
accounting community pos odoo17
Imagine profil
0
mar. 25
2017
settings multi company
settings python multicompany odoo17
Imagine profil
0
mai 24
2185
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة 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 este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

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