From 0d3f5927e5953381649231757a03060413a2a875 Mon Sep 17 00:00:00 2001 From: JordiMForgeFlow Date: Wed, 28 Oct 2026 14:21:12 +0100 Subject: [PATCH 1/3] [IMP] webservice: do not override timeout The requests adapters set the timeout to None on every call, discarding the one given by the caller. A call to a peer that accepts the connection but never answers then holds the worker until the peer closes the socket, which in a cron can block every other scheduled action for as long as the worker time limit allows. The timeout now travels in kwargs like any other requests parameter. Callers that pass none keep the previous behaviour, as requests defaults to no timeout. --- webservice/components/request_adapter.py | 2 -- webservice/tests/common.py | 2 +- webservice/tests/test_oauth2.py | 3 ++- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/webservice/components/request_adapter.py b/webservice/components/request_adapter.py index 99645343..bdaa1685 100644 --- a/webservice/components/request_adapter.py +++ b/webservice/components/request_adapter.py @@ -35,7 +35,6 @@ def _request(self, method, url=None, url_params=None, **kwargs): { "auth": self._get_auth(**kwargs), "headers": self._get_headers(**kwargs), - "timeout": None, } ) # pylint: disable=E8106 @@ -211,7 +210,6 @@ def _request(self, method, url=None, url_params=None, **kwargs): new_kwargs.update( { "headers": self._get_headers(**kwargs), - "timeout": None, } ) client = BackendApplicationClient(client_id=self.collection.oauth2_clientid) diff --git a/webservice/tests/common.py b/webservice/tests/common.py index ff2dde77..22bbd60f 100644 --- a/webservice/tests/common.py +++ b/webservice/tests/common.py @@ -39,7 +39,7 @@ def setUpClass(cls): @classmethod def _request_handler(cls, s: Session, r: PreparedRequest, /, **kw): if urlparse(r.url).netloc in ("localhost.demo.odoo", "custom.url"): - return cls._super_send(s, r) + return cls._super_send(s, r, **kw) return super()._request_handler(s, r, **kw) diff --git a/webservice/tests/test_oauth2.py b/webservice/tests/test_oauth2.py index 1288cda8..1ea1d217 100644 --- a/webservice/tests/test_oauth2.py +++ b/webservice/tests/test_oauth2.py @@ -56,7 +56,7 @@ def test_fetch_token(self): ) responses.add(responses.GET, f"{self.url}endpoint", body="OK") with mock_cursor(self.env.cr): - result = self.webservice.call("get", url=f"{self.url}endpoint") + result = self.webservice.call("get", url=f"{self.url}endpoint", timeout=10) self.webservice.invalidate_recordset() self.assertEqual(len(responses.calls), 2) call_token = json.loads(responses.calls[0].response.content.decode()) @@ -71,6 +71,7 @@ def test_fetch_token(self): ) self.assertEqual(responses.calls[1].response.content.decode(), "OK") self.assertEqual(result.decode(), "OK") + self.assertEqual(responses.calls[-1].request.req_kwargs["timeout"], 10) @responses.activate def test_update_token(self): From 303b8ecc551140ecaaddd2187db853a3dae56942 Mon Sep 17 00:00:00 2001 From: Manh Nguyen Date: Mon, 2 Nov 2026 09:04:41 +0700 Subject: [PATCH 2/3] [FIX] webservice: authorization URL and scope required for the web application flow The form made them required when oauth2_flow == 'authorization_code', a value that does not exist (the selection value is 'web_application'), so a web application backend could be saved without an authorization URL, and the Authorize button then failed. --- webservice/views/webservice_backend.xml | 4 +-- webservice_server_env/tests/test_oauth2.py | 30 ++++++++++++++++++++++ 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/webservice/views/webservice_backend.xml b/webservice/views/webservice_backend.xml index 6b398d92..e710fcf3 100644 --- a/webservice/views/webservice_backend.xml +++ b/webservice/views/webservice_backend.xml @@ -93,12 +93,12 @@ Date: Thu, 5 Nov 2026 16:22:33 +0100 Subject: [PATCH 3/3] [IMP] webservice_server_env: do not auto install Managing the webservice backends via the server environment is an explicit choice: installing webservice and server_environment together must not enable it, e.g. when the backends are configured otherwise (confidoo, UI, ...). --- webservice_server_env/README.rst | 3 +++ webservice_server_env/__manifest__.py | 1 - webservice_server_env/readme/DESCRIPTION.md | 3 +++ webservice_server_env/static/description/index.html | 2 ++ 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/webservice_server_env/README.rst b/webservice_server_env/README.rst index 65c7f274..17267818 100644 --- a/webservice_server_env/README.rst +++ b/webservice_server_env/README.rst @@ -35,6 +35,9 @@ WebService Server Environment Glue module to make Server Environment features available for the Webservice addon. +It is not installed automatically: install it explicitly to manage the +webservice backends via the server environment. + **Table of contents** .. contents:: diff --git a/webservice_server_env/__manifest__.py b/webservice_server_env/__manifest__.py index 9042866e..006538ee 100644 --- a/webservice_server_env/__manifest__.py +++ b/webservice_server_env/__manifest__.py @@ -16,5 +16,4 @@ "depends": ["web", "webservice", "server_environment"], "post_init_hook": "post_init_hook", "uninstall_hook": "uninstall_hook", - "auto_install": True, } diff --git a/webservice_server_env/readme/DESCRIPTION.md b/webservice_server_env/readme/DESCRIPTION.md index 1c6edaa6..43d2e3fe 100644 --- a/webservice_server_env/readme/DESCRIPTION.md +++ b/webservice_server_env/readme/DESCRIPTION.md @@ -1,2 +1,5 @@ Glue module to make Server Environment features available for the Webservice addon. + +It is not installed automatically: install it explicitly to manage the +webservice backends via the server environment. diff --git a/webservice_server_env/static/description/index.html b/webservice_server_env/static/description/index.html index 06fa772a..37477a51 100644 --- a/webservice_server_env/static/description/index.html +++ b/webservice_server_env/static/description/index.html @@ -377,6 +377,8 @@

WebService Server Environment

Production/Stable License: AGPL-3 OCA/web-api Translate me on Weblate Try me on Runboat

Glue module to make Server Environment features available for the Webservice addon.

+

It is not installed automatically: install it explicitly to manage the +webservice backends via the server environment.

Table of contents