From eb3501d602648f62f5895438024a3e805b652cba Mon Sep 17 00:00:00 2001 From: Benjamin Willig Date: Wed, 17 Apr 2024 18:01:51 +0200 Subject: [PATCH 1/2] [FIX] queue_job: fix exception msg handling 'name' attributes for odoo's exception has been deprecated and produces a warning message. This commit fixes the behavior --- queue_job/controllers/main.py | 4 +++- queue_job/tests/__init__.py | 1 + queue_job/tests/test_run_rob_controller.py | 17 +++++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 queue_job/tests/test_run_rob_controller.py diff --git a/queue_job/controllers/main.py b/queue_job/controllers/main.py index fce3049fa0..f9d54fed0f 100644 --- a/queue_job/controllers/main.py +++ b/queue_job/controllers/main.py @@ -162,7 +162,9 @@ def _get_failure_values(self, job, traceback_txt, orig_exception): exception_name = orig_exception.__class__.__name__ if hasattr(orig_exception, "__module__"): exception_name = orig_exception.__module__ + "." + exception_name - exc_message = getattr(orig_exception, "name", str(orig_exception)) + exc_message = ( + orig_exception.args[0] if orig_exception.args else str(orig_exception) + ) return { "exc_info": traceback_txt, "exc_name": exception_name, diff --git a/queue_job/tests/__init__.py b/queue_job/tests/__init__.py index 2fdff496bc..1062acdc25 100644 --- a/queue_job/tests/__init__.py +++ b/queue_job/tests/__init__.py @@ -1,3 +1,4 @@ +from . import test_run_rob_controller from . import test_runner_channels from . import test_runner_runner from . import test_delayable diff --git a/queue_job/tests/test_run_rob_controller.py b/queue_job/tests/test_run_rob_controller.py new file mode 100644 index 0000000000..bb63bc82ec --- /dev/null +++ b/queue_job/tests/test_run_rob_controller.py @@ -0,0 +1,17 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo.tests.common import TransactionCase + +from ..controllers.main import RunJobController +from ..job import Job + + +class TestRunJobController(TransactionCase): + def test_get_failure_values(self): + method = self.env["res.users"].mapped + job = Job(method) + ctrl = RunJobController() + rslt = ctrl._get_failure_values(job, "info", Exception("zero", "one")) + self.assertEqual( + rslt, {"exc_info": "info", "exc_name": "Exception", "exc_message": "zero"} + ) From c9e92aafec5adf9b26cfea4efc73089cd5e19c55 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Thu, 18 Sep 2025 13:00:16 +0000 Subject: [PATCH 2/2] [BOT] post-merge updates --- README.md | 2 +- queue_job/README.rst | 2 +- queue_job/__manifest__.py | 2 +- queue_job/static/description/index.html | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index cdf5dd44f1..902aef02e1 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Available addons addon | version | maintainers | summary --- | --- | --- | --- [base_import_async](base_import_async/) | 17.0.1.0.0 | | Import CSV files in the background -[queue_job](queue_job/) | 17.0.1.4.2 | guewen | Job Queue +[queue_job](queue_job/) | 17.0.1.4.3 | guewen | Job Queue [queue_job_cron](queue_job_cron/) | 17.0.1.1.0 | | Scheduled Actions as Queue Jobs [queue_job_cron_jobrunner](queue_job_cron_jobrunner/) | 17.0.1.1.0 | ivantodorovich | Run jobs without a dedicated JobRunner [queue_job_subscribe](queue_job_subscribe/) | 17.0.1.0.0 | | Control which users are subscribed to queue job notifications diff --git a/queue_job/README.rst b/queue_job/README.rst index 16c0e45d34..37e9529ff2 100644 --- a/queue_job/README.rst +++ b/queue_job/README.rst @@ -11,7 +11,7 @@ Job Queue !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:1e255eae2042abbd08d870b684c443f75624a6e639b7472f169e755fb6d8ab99 + !! source digest: sha256:5c7d6692e11a4d5d03e2fd23cfcf6068d23e685be5e1bc7f760de482512c3083 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Mature-brightgreen.png diff --git a/queue_job/__manifest__.py b/queue_job/__manifest__.py index 34d9575904..c61f234e8c 100644 --- a/queue_job/__manifest__.py +++ b/queue_job/__manifest__.py @@ -2,7 +2,7 @@ { "name": "Job Queue", - "version": "17.0.1.4.2", + "version": "17.0.1.4.3", "author": "Camptocamp,ACSONE SA/NV,Odoo Community Association (OCA)", "website": "https://github.com/OCA/queue", "license": "LGPL-3", diff --git a/queue_job/static/description/index.html b/queue_job/static/description/index.html index 8b208cffce..5d64e6a9d2 100644 --- a/queue_job/static/description/index.html +++ b/queue_job/static/description/index.html @@ -372,7 +372,7 @@

Job Queue

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:1e255eae2042abbd08d870b684c443f75624a6e639b7472f169e755fb6d8ab99 +!! source digest: sha256:5c7d6692e11a4d5d03e2fd23cfcf6068d23e685be5e1bc7f760de482512c3083 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

Mature License: LGPL-3 OCA/queue Translate me on Weblate Try me on Runboat

This addon adds an integrated Job Queue to Odoo.