From 192ea0cee97722f06be769b0068ff166f0e18696 Mon Sep 17 00:00:00 2001
From: xmo-odoo <xmo@odoo.com>
Date: Fri, 26 Aug 2022 09:46:46 +0000
Subject: [PATCH] [FIX] bus: fix import to not rely in implicit sub-module
 imports

Also, define `Event` attribute in `__init__` where it belongs.

Part-of: odoo/odoo#98081
---
 addons/bus/models/bus.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/addons/bus/models/bus.py b/addons/bus/models/bus.py
index b88a833601bc..9ec7b0db526f 100644
--- a/addons/bus/models/bus.py
+++ b/addons/bus/models/bus.py
@@ -99,6 +99,7 @@ class ImDispatch(object):
     def __init__(self):
         self.channels = {}
         self.started = False
+        self.Event = None
 
     def poll(self, dbname, channels, last, options=None, timeout=TIMEOUT):
         if options is None:
@@ -181,7 +182,7 @@ class ImDispatch(object):
     def start(self):
         if odoo.evented:
             # gevent mode
-            import gevent
+            import gevent.event  # pylint: disable=import-outside-toplevel
             self.Event = gevent.event.Event
             gevent.spawn(self.run)
         else:
-- 
GitLab