From 80151dfbbffcb05aecdd4a785cddc569bbea5a6b Mon Sep 17 00:00:00 2001 From: eLBati Date: Tue, 26 Oct 2021 15:41:05 +0200 Subject: [PATCH 1/2] FIX queue_job avoiding AccessDenied when loading the module in an instance with list_db = False The scenario is a multi database environment where you can't set db_name as the databases change frequently and you use dbfilter to allow users to access their DB according to domain --- queue_job/jobrunner/runner.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/queue_job/jobrunner/runner.py b/queue_job/jobrunner/runner.py index 2314510731..25823a9973 100644 --- a/queue_job/jobrunner/runner.py +++ b/queue_job/jobrunner/runner.py @@ -401,7 +401,7 @@ def get_db_names(self): if config["db_name"]: db_names = config["db_name"].split(",") else: - db_names = odoo.service.db.exp_list(True) + db_names = odoo.service.db.list_dbs(True) return db_names def close_databases(self, remove_jobs=True): From ff412472d48b6a3fb3a67b85b5581c580dbce22f Mon Sep 17 00:00:00 2001 From: pcastelovigo Date: Wed, 22 Nov 2023 16:50:56 +0100 Subject: [PATCH 2/2] queue job avoiding AccessDenied when loading the module in an instance with list_db=false --- queue_job/jobrunner/runner.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/queue_job/jobrunner/runner.py b/queue_job/jobrunner/runner.py index 25823a9973..d823552dda 100644 --- a/queue_job/jobrunner/runner.py +++ b/queue_job/jobrunner/runner.py @@ -398,6 +398,12 @@ def from_environ_or_config(cls): return runner def get_db_names(self): + """ + >>> runner = QueueJobRunner() + >>> config["db_name"] = None + >>> runner.get_db_names() + ['odoo'] + """ if config["db_name"]: db_names = config["db_name"].split(",") else: