Skip to content

Commit e7009e4

Browse files
committed
Merge PR #262 into 18.0
Signed-off-by gurneyalex
2 parents 8868ad5 + a10aa58 commit e7009e4

6 files changed

Lines changed: 290 additions & 34 deletions

File tree

mail_environment/README.rst

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
.. image:: https://odoo-community.org/readme-banner-image
2-
:target: https://odoo-community.org/get-involved?utm_source=readme
3-
:alt: Odoo Community Association
4-
51
==========================================
62
Mail configuration with server_environment
73
==========================================
@@ -17,7 +13,7 @@ Mail configuration with server_environment
1713
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
1814
:target: https://odoo-community.org/page/development-status
1915
:alt: Beta
20-
.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
16+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
2117
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
2218
:alt: License: AGPL-3
2319
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--env-lightgray.png?logo=github
@@ -103,8 +99,8 @@ file.
10399
Known issues / Roadmap
104100
======================
105101

106-
- Due to the special nature of this addon, you cannot test it on the OCA
107-
runbot.
102+
- Due to the special nature of this addon, you cannot test it on the
103+
OCA runbot.
108104

109105
Bug Tracker
110106
===========
@@ -127,12 +123,12 @@ Authors
127123
Contributors
128124
------------
129125

130-
- Nicolas Bessi <nicolas.bessi@camptocamp.com>
131-
- Yannick Vaucher <yannick.vaucher@camptocamp.com>
132-
- Guewen Baconnier <guewen.baconnier@camptocamp.com>
133-
- Joël Grand-Guillaume <joel.grandguillaume@camptocamp.com>
134-
- Holger Brunn <hbrunn@therp.nl>
135-
- Alexandre Fayolle <alexandre.fayolle@camptocamp.com>
126+
- Nicolas Bessi <nicolas.bessi@camptocamp.com>
127+
- Yannick Vaucher <yannick.vaucher@camptocamp.com>
128+
- Guewen Baconnier <guewen.baconnier@camptocamp.com>
129+
- Joël Grand-Guillaume <joel.grandguillaume@camptocamp.com>
130+
- Holger Brunn <hbrunn@therp.nl>
131+
- Alexandre Fayolle <alexandre.fayolle@camptocamp.com>
136132

137133
Maintainers
138134
-----------

mail_environment/__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

mail_environment/__manifest__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@
1010
"license": "AGPL-3",
1111
"website": "https://github.com/OCA/server-env",
1212
"depends": ["mail", "server_environment"],
13+
"uninstall_hook": "uninstall_hook",
1314
}

mail_environment/hooks.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Copyright 2026 Camptocamp (https://www.camptocamp.com)
2+
from odoo.addons.server_environment.uninstall import restore_env_managed_columns
3+
4+
5+
def uninstall_hook(env):
6+
"""Restore database columns that server.env.mixin dropped for mail models.
7+
8+
When mail_environment is uninstalled, ``ir.mail_server`` and
9+
``fetchmail.server`` would be left without the columns that the ORM
10+
dropped when this addon was first installed. This hook recreates those
11+
columns and repopulates them with the current effective values so the
12+
database remains usable after removal.
13+
14+
After uninstalling this module, an Odoo server restart is required.
15+
Field definitions referencing the compute methods of the mixin persist in memory
16+
until the Python process restarts.
17+
"""
18+
restore_env_managed_columns(
19+
env,
20+
"ir.mail_server",
21+
[
22+
"smtp_host",
23+
"smtp_port",
24+
"smtp_user",
25+
"smtp_pass",
26+
"smtp_encryption",
27+
"smtp_authentication",
28+
],
29+
)
30+
restore_env_managed_columns(
31+
env,
32+
"fetchmail.server",
33+
[
34+
"server",
35+
"port",
36+
"server_type",
37+
"user",
38+
"password",
39+
"is_ssl",
40+
"attach",
41+
"original",
42+
],
43+
)

mail_environment/static/description/index.html

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
55
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
6-
<title>README.rst</title>
6+
<title>Mail configuration with server_environment</title>
77
<style type="text/css">
88

99
/*
@@ -360,21 +360,16 @@
360360
</style>
361361
</head>
362362
<body>
363-
<div class="document">
363+
<div class="document" id="mail-configuration-with-server-environment">
364+
<h1 class="title">Mail configuration with server_environment</h1>
364365

365-
366-
<a class="reference external image-reference" href="https://odoo-community.org/get-involved?utm_source=readme">
367-
<img alt="Odoo Community Association" src="https://odoo-community.org/readme-banner-image" />
368-
</a>
369-
<div class="section" id="mail-configuration-with-server-environment">
370-
<h1>Mail configuration with server_environment</h1>
371366
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
372367
!! This file is generated by oca-gen-addon-readme !!
373368
!! changes will be overwritten. !!
374369
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
375370
!! source digest: sha256:b27d3ac30fd7cb59d6eed6d0f910db100f70a145e028b2096015bcd7022a33b3
376371
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
377-
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/server-env/tree/18.0/mail_environment"><img alt="OCA/server-env" src="https://img.shields.io/badge/github-OCA%2Fserver--env-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/server-env-18-0/server-env-18-0-mail_environment"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/server-env&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
372+
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/server-env/tree/18.0/mail_environment"><img alt="OCA/server-env" src="https://img.shields.io/badge/github-OCA%2Fserver--env-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/server-env-18-0/server-env-18-0-mail_environment"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/server-env&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
378373
<p>This module allows to configure the incoming and outgoing mail servers
379374
using the server_environment mechanism: you can then have different mail
380375
servers for the production and the test environment.</p>
@@ -395,12 +390,12 @@ <h1>Mail configuration with server_environment</h1>
395390
</ul>
396391
</div>
397392
<div class="section" id="installation">
398-
<h2><a class="toc-backref" href="#toc-entry-1">Installation</a></h2>
393+
<h1><a class="toc-backref" href="#toc-entry-1">Installation</a></h1>
399394
<p>To install this module, you need to have the server_environment module
400395
installed and properly configured.</p>
401396
</div>
402397
<div class="section" id="configuration">
403-
<h2><a class="toc-backref" href="#toc-entry-2">Configuration</a></h2>
398+
<h1><a class="toc-backref" href="#toc-entry-2">Configuration</a></h1>
404399
<p>With this module installed, the incoming and outgoing mail servers are
405400
configured in the server_environment_files module (which is a module you
406401
should provide, see the documentation of server_environment for more
@@ -440,36 +435,36 @@ <h2><a class="toc-backref" href="#toc-entry-2">Configuration</a></h2>
440435
mail server with the field name set to “odoo_pop_mail1”.</p>
441436
</div>
442437
<div class="section" id="usage">
443-
<h2><a class="toc-backref" href="#toc-entry-3">Usage</a></h2>
438+
<h1><a class="toc-backref" href="#toc-entry-3">Usage</a></h1>
444439
<p>Once configured, Odoo will read the mail servers values from the
445440
configuration file related to each environment defined in the main Odoo
446441
file.</p>
447442
</div>
448443
<div class="section" id="known-issues-roadmap">
449-
<h2><a class="toc-backref" href="#toc-entry-4">Known issues / Roadmap</a></h2>
444+
<h1><a class="toc-backref" href="#toc-entry-4">Known issues / Roadmap</a></h1>
450445
<ul class="simple">
451-
<li>Due to the special nature of this addon, you cannot test it on the OCA
452-
runbot.</li>
446+
<li>Due to the special nature of this addon, you cannot test it on the
447+
OCA runbot.</li>
453448
</ul>
454449
</div>
455450
<div class="section" id="bug-tracker">
456-
<h2><a class="toc-backref" href="#toc-entry-5">Bug Tracker</a></h2>
451+
<h1><a class="toc-backref" href="#toc-entry-5">Bug Tracker</a></h1>
457452
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/server-env/issues">GitHub Issues</a>.
458453
In case of trouble, please check there if your issue has already been reported.
459454
If you spotted it first, help us to smash it by providing a detailed and welcomed
460455
<a class="reference external" href="https://github.com/OCA/server-env/issues/new?body=module:%20mail_environment%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
461456
<p>Do not contact contributors directly about support or help with technical issues.</p>
462457
</div>
463458
<div class="section" id="credits">
464-
<h2><a class="toc-backref" href="#toc-entry-6">Credits</a></h2>
459+
<h1><a class="toc-backref" href="#toc-entry-6">Credits</a></h1>
465460
<div class="section" id="authors">
466-
<h3><a class="toc-backref" href="#toc-entry-7">Authors</a></h3>
461+
<h2><a class="toc-backref" href="#toc-entry-7">Authors</a></h2>
467462
<ul class="simple">
468463
<li>Camptocamp</li>
469464
</ul>
470465
</div>
471466
<div class="section" id="contributors">
472-
<h3><a class="toc-backref" href="#toc-entry-8">Contributors</a></h3>
467+
<h2><a class="toc-backref" href="#toc-entry-8">Contributors</a></h2>
473468
<ul class="simple">
474469
<li>Nicolas Bessi &lt;<a class="reference external" href="mailto:nicolas.bessi&#64;camptocamp.com">nicolas.bessi&#64;camptocamp.com</a>&gt;</li>
475470
<li>Yannick Vaucher &lt;<a class="reference external" href="mailto:yannick.vaucher&#64;camptocamp.com">yannick.vaucher&#64;camptocamp.com</a>&gt;</li>
@@ -480,7 +475,7 @@ <h3><a class="toc-backref" href="#toc-entry-8">Contributors</a></h3>
480475
</ul>
481476
</div>
482477
<div class="section" id="maintainers">
483-
<h3><a class="toc-backref" href="#toc-entry-9">Maintainers</a></h3>
478+
<h2><a class="toc-backref" href="#toc-entry-9">Maintainers</a></h2>
484479
<p>This module is maintained by the OCA.</p>
485480
<a class="reference external image-reference" href="https://odoo-community.org">
486481
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
@@ -493,6 +488,5 @@ <h3><a class="toc-backref" href="#toc-entry-9">Maintainers</a></h3>
493488
</div>
494489
</div>
495490
</div>
496-
</div>
497491
</body>
498492
</html>

0 commit comments

Comments
 (0)