Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions webservice_server_env/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
from . import models
from .hooks import uninstall_hook
1 change: 1 addition & 0 deletions webservice_server_env/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@
"author": "Creu Blanca, Camptocamp, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/web-api",
"depends": ["web", "webservice", "server_environment"],
"uninstall_hook": "uninstall_hook",
"auto_install": True,
}
34 changes: 34 additions & 0 deletions webservice_server_env/hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright 2025 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo.addons.server_environment.uninstall import restore_env_managed_columns


def uninstall_hook(env):
"""Restore database columns dropped by server.env.mixin.

When the module is uninstalled, the columns managed by the server
environment mixin must be restored and repopulated with current values,
so the database remains usable.
"""
restore_env_managed_columns(
env,
"webservice.backend",
[
"protocol",
"url",
"auth_type",
"username",
"password",
"api_key",
"api_key_header",
"content_type",
"oauth2_flow",
"oauth2_scope",
"oauth2_clientid",
"oauth2_client_secret",
"oauth2_authorization_url",
"oauth2_token_url",
"oauth2_audience",
],
)
Loading