Skip to content

Commit 551d3e8

Browse files
committed
Merge PR #141 into 19.0
Signed-off-by simahawk
2 parents 1713838 + 756c445 commit 551d3e8

3 files changed

Lines changed: 36 additions & 0 deletions

File tree

webservice_server_env/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
from . import models
2+
from .hooks import uninstall_hook

webservice_server_env/__manifest__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@
1414
"author": "Creu Blanca, Camptocamp, Odoo Community Association (OCA)",
1515
"website": "https://github.com/OCA/web-api",
1616
"depends": ["web", "webservice", "server_environment"],
17+
"uninstall_hook": "uninstall_hook",
1718
"auto_install": True,
1819
}

webservice_server_env/hooks.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Copyright 2025 Camptocamp SA
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3+
4+
from odoo.addons.server_environment.uninstall import restore_env_managed_columns
5+
6+
7+
def uninstall_hook(env):
8+
"""Restore database columns dropped by server.env.mixin.
9+
10+
When the module is uninstalled, the columns managed by the server
11+
environment mixin must be restored and repopulated with current values,
12+
so the database remains usable.
13+
"""
14+
restore_env_managed_columns(
15+
env,
16+
"webservice.backend",
17+
[
18+
"protocol",
19+
"url",
20+
"auth_type",
21+
"username",
22+
"password",
23+
"api_key",
24+
"api_key_header",
25+
"content_type",
26+
"oauth2_flow",
27+
"oauth2_scope",
28+
"oauth2_clientid",
29+
"oauth2_client_secret",
30+
"oauth2_authorization_url",
31+
"oauth2_token_url",
32+
"oauth2_audience",
33+
],
34+
)

0 commit comments

Comments
 (0)