From 599a03cfb89b51e2f515f87206b364e0e7c73ece Mon Sep 17 00:00:00 2001 From: Cybrosys Technologies Date: Thu, 19 Sep 2024 19:23:46 +0530 Subject: [PATCH] Sep 19: [FIX] Bug Fixed 'auto_logout_idle_user_odoo' --- auto_logout_idle_user_odoo/static/src/js/systray.js | 11 +++++++---- auto_logout_idle_user_odoo/static/src/xml/systray.xml | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/auto_logout_idle_user_odoo/static/src/js/systray.js b/auto_logout_idle_user_odoo/static/src/js/systray.js index a17d51079..da97a8b0f 100644 --- a/auto_logout_idle_user_odoo/static/src/js/systray.js +++ b/auto_logout_idle_user_odoo/static/src/js/systray.js @@ -11,6 +11,9 @@ class TimerSystrayItem extends Component{ setup(){ super.setup(); this.get_idle_time(); + this.state = useState({ + idle_time: null, + }) } get_idle_time() { var self = this @@ -42,16 +45,16 @@ class TimerSystrayItem extends Component{ var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); var seconds = Math.floor((distance % (1000 * 60)) / 1000); if (hours && days) { - document.querySelector("#idle_timer").innerHTML = days + "d " + hours + "h " + minutes + "m " + seconds + "s "; + self.state.idle_time = days + "d " + hours + "h " + minutes + "m " + seconds + "s "; } else if (hours) { - document.querySelector("#idle_timer").innerHTML = hours + "h " + minutes + "m " + seconds + "s "; + self.state.idle_time = hours + "h " + minutes + "m " + seconds + "s "; } else { - document.querySelector("#idle_timer").innerHTML = minutes + "m " + seconds + "s "; + self.state.idle_time = minutes + "m " + seconds + "s "; } /** if the countdown is zero the link is redirect to the login page*/ if (distance < 0) { clearInterval(idle); - document.querySelector("#idle_timer").innerHTML = "EXPIRED"; + self.state.idle_time = "EXPIRED"; location.replace("/web/session/logout") } }, 1000); diff --git a/auto_logout_idle_user_odoo/static/src/xml/systray.xml b/auto_logout_idle_user_odoo/static/src/xml/systray.xml index 8a91c6509..ffdee1a75 100644 --- a/auto_logout_idle_user_odoo/static/src/xml/systray.xml +++ b/auto_logout_idle_user_odoo/static/src/xml/systray.xml @@ -5,7 +5,7 @@
-

+