Skip to Content
Odoo Menu
  • Zaloguj się
  • Wypróbuj za darmo
  • Aplikacje
    Finanse
    • Księgowość
    • Fakturowanie
    • Wydatki
    • Arkusz kalkulacyjny (BI)
    • Dokumenty
    • Podpisy
    Sprzedaż
    • CRM
    • Sprzedaż
    • PoS Sklep
    • PoS Restauracja
    • Subskrypcje
    • Wypożyczalnia
    Strony Internetowe
    • Kreator Stron Internetowych
    • eCommerce
    • Blog
    • Forum
    • Czat na Żywo
    • eLearning
    Łańcuch dostaw
    • Magazyn
    • Produkcja
    • PLM
    • Zakupy
    • Konserwacja
    • Jakość
    Zasoby Ludzkie
    • Pracownicy
    • Rekrutacja
    • Urlopy
    • Ocena pracy
    • Polecenia Pracownicze
    • Flota
    Marketing
    • Marketing Społecznościowy
    • E-mail Marketing
    • SMS Marketing
    • Wydarzenia
    • Automatyzacja Marketingu
    • Ankiety
    Usługi
    • Projekt
    • Ewidencja czasu pracy
    • Usługi Terenowe
    • Helpdesk
    • Planowanie
    • Spotkania
    Produktywność
    • Dyskusje
    • Zatwierdzenia
    • IoT
    • VoIP
    • Baza wiedzy
    • WhatsApp
    Aplikacje trzecich stron Studio Odoo Odoo Cloud Platform
  • Branże
    Sprzedaż detaliczna
    • Księgarnia
    • Sklep odzieżowy
    • Sklep meblowy
    • Sklep spożywczy
    • Sklep z narzędziami
    • Sklep z zabawkami
    Żywienie i hotelarstwo
    • Bar i Pub
    • Restauracja
    • Fast Food
    • Pensjonat
    • Dystrybutor napojów
    • Hotel
    Agencja nieruchomości
    • Agencja nieruchomości
    • Biuro architektoniczne
    • Budowa
    • Zarządzanie nieruchomościami
    • Ogrodnictwo
    • Stowarzyszenie właścicieli nieruchomości
    Doradztwo
    • Biuro księgowe
    • Partner Odoo
    • Agencja marketingowa
    • Kancelaria prawna
    • Agencja rekrutacyjna
    • Audyt i certyfikacja
    Produkcja
    • Tekstylia
    • Metal
    • Meble
    • Jedzenie
    • Browar
    • Prezenty firmowe
    Zdrowie & Fitness
    • Klub sportowy
    • Salon optyczny
    • Centrum fitness
    • Praktycy Wellness
    • Apteka
    • Salon fryzjerski
    Transakcje
    • Złota rączka
    • Wsparcie Sprzętu IT
    • Systemy energii słonecznej
    • Szewc
    • Firma sprzątająca
    • Usługi HVAC
    Inne
    • Organizacja non-profit
    • Agencja Środowiskowa
    • Wynajem billboardów
    • Fotografia
    • Leasing rowerów
    • Sprzedawca oprogramowania
    Przeglądaj wszystkie branże
  • Community
    Ucz się
    • Samouczki
    • Dokumentacja
    • Certyfikacje
    • Szkolenie
    • Blog
    • Podcast
    Pomóż w nauce innym
    • Program Edukacyjny
    • Scale Up! Gra biznesowa
    • Odwiedź Odoo
    Skorzystaj z oprogramowania
    • Pobierz
    • Porównaj edycje
    • Wydania
    Współpracuj
    • Github
    • Forum
    • Wydarzenia
    • Tłumaczenia
    • Zostań partnerem
    • Usługi dla partnerów
    • Zarejestruj swoją firmę rachunkową
    Skorzystaj z usług
    • Znajdź partnera
    • Znajdź księgowego
    • Spotkaj się z doradcą
    • Usługi wdrożenia
    • Opinie klientów
    • Wsparcie
    • Aktualizacje
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Zaplanuj demo
  • Cennik
  • Pomoc

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

  • CRM
  • e-Commerce
  • Księgowość
  • Zapasy
  • PoS
  • Projekt
  • MRP
All apps
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Pomoc

Log out session Odoo 17

Zaprenumeruj

Otrzymaj powiadomienie o aktywności w tym poście

To pytanie dostało ostrzeżenie
communitypythonodoo17
2 Odpowiedzi
3367 Widoki
Awatar
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
Awatar
Odrzuć
Awatar
Cybrosys Techno Solutions Pvt.Ltd
Najlepsza odpowiedź

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
Awatar
Odrzuć
Awatar
Ritik (Wan Buffer Services)
Najlepsza odpowiedź

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
Awatar
Odrzuć
Podoba Ci się ta dyskusja? Dołącz do niej!

Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!

Zarejestruj się
Powiązane posty Odpowiedzi Widoki Czynność
Request for Compatible Low Stock Alerts Module for Odoo 17.0-20240718 Community Edition
community models odoo17
Awatar
Awatar
Awatar
2
cze 25
2096
Error Report: Odoo 17 Installation Issue
python postgresql odoo17
Awatar
0
sie 24
2662
Issue with Access Rules for Attachments / odoo 17 Rozwiązane
security python xml odoo17
Awatar
Awatar
Awatar
Awatar
Awatar
4
cze 25
4037
Foreign Key Constraint Error When Closing POS Session in Odoo 17 Community
accounting community pos odoo17
Awatar
0
mar 25
2017
settings multi company
settings python multicompany odoo17
Awatar
0
maj 24
2185
Społeczność
  • Samouczki
  • Dokumentacja
  • Forum
Open Source
  • Pobierz
  • Github
  • Runbot
  • Tłumaczenia
Usługi
  • Hosting Odoo.sh
  • Wsparcie
  • Aktualizacja
  • Indywidualne rozwiązania
  • Edukacja
  • Znajdź księgowego
  • Znajdź partnera
  • Zostań partnerem
O nas
  • Nasza firma
  • Zasoby marki
  • Skontaktuj się z nami
  • Oferty pracy
  • Wydarzenia
  • Podcast
  • Blog
  • Klienci
  • Informacje prawne • Prywatność
  • Bezpieczeństwo Odoo
الْعَرَبيّة 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 to pakiet aplikacji biznesowych typu open source, które zaspokoją wszystkie potrzeby Twojej firmy: CRM, eCommerce, księgowość, inwentaryzacja, punkt sprzedaży, zarządzanie projektami itp.

Unikalną wartością Odoo jest to, że jest jednocześnie bardzo łatwe w użyciu i w pełni zintegrowane.

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