diff --git a/mail_environment/README.rst b/mail_environment/README.rst index d0f79cea0..fb7ee8f5a 100644 --- a/mail_environment/README.rst +++ b/mail_environment/README.rst @@ -1,7 +1,3 @@ -.. image:: https://odoo-community.org/readme-banner-image - :target: https://odoo-community.org/get-involved?utm_source=readme - :alt: Odoo Community Association - ========================================== Mail configuration with server_environment ========================================== @@ -17,7 +13,7 @@ Mail configuration with server_environment .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png :target: https://odoo-community.org/page/development-status :alt: Beta -.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--env-lightgray.png?logo=github @@ -103,8 +99,8 @@ file. Known issues / Roadmap ====================== -- Due to the special nature of this addon, you cannot test it on the OCA - runbot. +- Due to the special nature of this addon, you cannot test it on the + OCA runbot. Bug Tracker =========== @@ -127,12 +123,12 @@ Authors Contributors ------------ -- Nicolas Bessi -- Yannick Vaucher -- Guewen Baconnier -- Joël Grand-Guillaume -- Holger Brunn -- Alexandre Fayolle +- Nicolas Bessi +- Yannick Vaucher +- Guewen Baconnier +- Joël Grand-Guillaume +- Holger Brunn +- Alexandre Fayolle Maintainers ----------- diff --git a/mail_environment/__init__.py b/mail_environment/__init__.py index 0650744f6..071962a35 100644 --- a/mail_environment/__init__.py +++ b/mail_environment/__init__.py @@ -1 +1,2 @@ from . import models +from .hooks import uninstall_hook diff --git a/mail_environment/__manifest__.py b/mail_environment/__manifest__.py index b20d02d35..a579b0fa1 100644 --- a/mail_environment/__manifest__.py +++ b/mail_environment/__manifest__.py @@ -10,4 +10,5 @@ "license": "AGPL-3", "website": "https://github.com/OCA/server-env", "depends": ["mail", "server_environment"], + "uninstall_hook": "uninstall_hook", } diff --git a/mail_environment/hooks.py b/mail_environment/hooks.py new file mode 100644 index 000000000..bdab5d78c --- /dev/null +++ b/mail_environment/hooks.py @@ -0,0 +1,43 @@ +# Copyright 2026 Camptocamp (https://www.camptocamp.com) +from odoo.addons.server_environment.uninstall import restore_env_managed_columns + + +def uninstall_hook(env): + """Restore database columns that server.env.mixin dropped for mail models. + + When mail_environment is uninstalled, ``ir.mail_server`` and + ``fetchmail.server`` would be left without the columns that the ORM + dropped when this addon was first installed. This hook recreates those + columns and repopulates them with the current effective values so the + database remains usable after removal. + + After uninstalling this module, an Odoo server restart is required. + Field definitions referencing the compute methods of the mixin persist in memory + until the Python process restarts. + """ + restore_env_managed_columns( + env, + "ir.mail_server", + [ + "smtp_host", + "smtp_port", + "smtp_user", + "smtp_pass", + "smtp_encryption", + "smtp_authentication", + ], + ) + restore_env_managed_columns( + env, + "fetchmail.server", + [ + "server", + "port", + "server_type", + "user", + "password", + "is_ssl", + "attach", + "original", + ], + ) diff --git a/mail_environment/static/description/index.html b/mail_environment/static/description/index.html index 0f434f77e..135388a1d 100644 --- a/mail_environment/static/description/index.html +++ b/mail_environment/static/description/index.html @@ -3,7 +3,7 @@ -README.rst +Mail configuration with server_environment -
+
+

Mail configuration with server_environment

- - -Odoo Community Association - -
-

Mail configuration with server_environment