From 6c3853b7c480249d350667232c6a973f7c385c14 Mon Sep 17 00:00:00 2001 From: Aungkokolin1997 Date: Wed, 24 Dec 2025 02:55:35 +0000 Subject: [PATCH 1/6] [FIX] iap_mail_domain_blacklist: cannot install for list_db=False odoo.conf --- iap_mail_domain_blacklist/README.rst | 19 ++++-- iap_mail_domain_blacklist/hooks.py | 13 ++++- .../readme/CONFIGURE.rst | 9 +++ iap_mail_domain_blacklist/readme/ROADMAP.rst | 10 ++-- .../static/description/index.html | 58 ++++++++++++------- 5 files changed, 79 insertions(+), 30 deletions(-) diff --git a/iap_mail_domain_blacklist/README.rst b/iap_mail_domain_blacklist/README.rst index d70d264..012c667 100644 --- a/iap_mail_domain_blacklist/README.rst +++ b/iap_mail_domain_blacklist/README.rst @@ -56,16 +56,27 @@ Configuration 2. Search for "Mail Domain Blacklist" and enter the domains you want to blacklist, separated by commas. +Server configuration +~~~~~~~~~~~~~~~~~~~~~ + +In the odoo.conf file, set db_list = True to allow listing all databases. +In this case, blacklist domains from all databases will affect every database. +Set db_list = False and explicitly define db_name if you want to load only +the target database. In this case, blacklist domains will affect only that +database. + Note: Every time you update the "Mail Domain Blacklist," you need to restart the Odoo server for the change to take effect. Known issues / Roadmap ====================== -Due to a technical limitation, we cannot use http.db_list() to respect dbfilter -during module loading, as HTTP configuration is not available at that stage. -Therefore, db.list_dbs() is used instead. As a result, blacklist domains from inactive databases -will also affect running databases. +Due to a technical limitation, http.db_list() cannot be used during module +loading to respect dbfilter, because the HTTP layer is not initialized at +that stage. As a result, the module must rely on config.get('db_name') or +db.list_dbs() instead. Consequently, if list_db = True is enabled without +explicitly setting db_name in odoo.conf, blacklist domains from inactive +databases may incorrectly affect active databases. Bug Tracker =========== diff --git a/iap_mail_domain_blacklist/hooks.py b/iap_mail_domain_blacklist/hooks.py index da388b8..c3bb34a 100644 --- a/iap_mail_domain_blacklist/hooks.py +++ b/iap_mail_domain_blacklist/hooks.py @@ -3,8 +3,10 @@ import logging +from odoo.exceptions import AccessDenied from odoo.service import db from odoo.sql_db import db_connect +from odoo.tools import config from odoo.addons.iap.tools import iap_tools @@ -33,8 +35,17 @@ def update_mail_domain_blacklist(cr): iap_tools._MAIL_DOMAIN_BLACKLIST.update(additional_domains) +def _db_names(): + if config.get("db_name"): + return [n.strip() for n in config["db_name"].split(",") if n.strip()] + try: + return db.list_dbs() + except AccessDenied: + return [] + + def post_load_hook(): - for db_name in db.list_dbs(): + for db_name in _db_names(): try: with db_connect(db_name).cursor() as cr: update_mail_domain_blacklist(cr) diff --git a/iap_mail_domain_blacklist/readme/CONFIGURE.rst b/iap_mail_domain_blacklist/readme/CONFIGURE.rst index 4816137..96eb47b 100644 --- a/iap_mail_domain_blacklist/readme/CONFIGURE.rst +++ b/iap_mail_domain_blacklist/readme/CONFIGURE.rst @@ -2,5 +2,14 @@ 2. Search for "Mail Domain Blacklist" and enter the domains you want to blacklist, separated by commas. +Server configuration +~~~~~~~~~~~~~~~~~~~~~ + +In the odoo.conf file, set db_list = True to allow listing all databases. +In this case, blacklist domains from all databases will affect every database. +Set db_list = False and explicitly define db_name if you want to load only +the target database. In this case, blacklist domains will affect only that +database. + Note: Every time you update the "Mail Domain Blacklist," you need to restart the Odoo server for the change to take effect. diff --git a/iap_mail_domain_blacklist/readme/ROADMAP.rst b/iap_mail_domain_blacklist/readme/ROADMAP.rst index 99fecd4..4d8b650 100644 --- a/iap_mail_domain_blacklist/readme/ROADMAP.rst +++ b/iap_mail_domain_blacklist/readme/ROADMAP.rst @@ -1,4 +1,6 @@ -Due to a technical limitation, we cannot use http.db_list() to respect dbfilter -during module loading, as HTTP configuration is not available at that stage. -Therefore, db.list_dbs() is used instead. As a result, blacklist domains from inactive databases -will also affect running databases. +Due to a technical limitation, http.db_list() cannot be used during module +loading to respect dbfilter, because the HTTP layer is not initialized at +that stage. As a result, the module must rely on config.get('db_name') or +db.list_dbs() instead. Consequently, if list_db = True is enabled without +explicitly setting db_name in odoo.conf, blacklist domains from inactive +databases may incorrectly affect active databases. diff --git a/iap_mail_domain_blacklist/static/description/index.html b/iap_mail_domain_blacklist/static/description/index.html index 260635e..05ad3a2 100644 --- a/iap_mail_domain_blacklist/static/description/index.html +++ b/iap_mail_domain_blacklist/static/description/index.html @@ -8,10 +8,11 @@ /* :Author: David Goodger (goodger@python.org) -:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $ +:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $ :Copyright: This stylesheet has been placed in the public domain. Default cascading style sheet for the HTML output of Docutils. +Despite the name, some widely supported CSS2 features are used. See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to customize this style sheet. @@ -274,7 +275,7 @@ margin-left: 2em ; margin-right: 2em } -pre.code .ln { color: grey; } /* line numbers */ +pre.code .ln { color: gray; } /* line numbers */ pre.code, code { background-color: #eeeeee } pre.code .comment, code .comment { color: #5C6576 } pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold } @@ -300,7 +301,7 @@ span.pre { white-space: pre } -span.problematic { +span.problematic, pre.problematic { color: red } span.section-subtitle { @@ -377,13 +378,16 @@

IAP Mail Domain BlackList

-

Known issues / Roadmap

-

Due to a technical limitation, we cannot use http.db_list() to respect dbfilter -during module loading, as HTTP configuration is not available at that stage. -Therefore, db.list_dbs() is used instead. As a result, blacklist domains from inactive databases -will also affect running databases.

+

Known issues / Roadmap

+

Due to a technical limitation, http.db_list() cannot be used during module +loading to respect dbfilter, because the HTTP layer is not initialized at +that stage. As a result, the module must rely on config.get(‘db_name’) or +db.list_dbs() instead. Consequently, if list_db = True is enabled without +explicitly setting db_name in odoo.conf, blacklist domains from inactive +databases may incorrectly affect active databases.

-

Bug Tracker

+

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed @@ -422,15 +436,15 @@

Bug Tracker

Do not contact contributors directly about support or help with technical issues.

-

Credits

+

Credits

-

Authors

+

Authors

  • Quartile
-

Contributors

+

Contributors

-

Maintainers

+

Maintainers

This module is maintained by the OCA.

-Odoo Community Association + +Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

From ffc5fa028f3bd88fe1283bbd2a74632db52ee3db Mon Sep 17 00:00:00 2001 From: Aungkokolin1997 Date: Mon, 5 Jan 2026 04:10:12 +0000 Subject: [PATCH 2/6] imp readme --- iap_mail_domain_blacklist/readme/CONFIGURE.rst | 12 ------------ iap_mail_domain_blacklist/readme/DESCRIPTION.rst | 6 ++++-- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/iap_mail_domain_blacklist/readme/CONFIGURE.rst b/iap_mail_domain_blacklist/readme/CONFIGURE.rst index 96eb47b..39b2f86 100644 --- a/iap_mail_domain_blacklist/readme/CONFIGURE.rst +++ b/iap_mail_domain_blacklist/readme/CONFIGURE.rst @@ -1,15 +1,3 @@ 1. Go to Settings > General Settings. 2. Search for "Mail Domain Blacklist" and enter the domains you want to blacklist, separated by commas. - -Server configuration -~~~~~~~~~~~~~~~~~~~~~ - -In the odoo.conf file, set db_list = True to allow listing all databases. -In this case, blacklist domains from all databases will affect every database. -Set db_list = False and explicitly define db_name if you want to load only -the target database. In this case, blacklist domains will affect only that -database. - -Note: Every time you update the "Mail Domain Blacklist," you need to restart the Odoo server -for the change to take effect. diff --git a/iap_mail_domain_blacklist/readme/DESCRIPTION.rst b/iap_mail_domain_blacklist/readme/DESCRIPTION.rst index 3987edb..3daa627 100644 --- a/iap_mail_domain_blacklist/readme/DESCRIPTION.rst +++ b/iap_mail_domain_blacklist/readme/DESCRIPTION.rst @@ -1,5 +1,7 @@ This module allows adding domains to the mail domain blacklist to prevent Odoo from assuming that users with the same domain belong to the same organization. -Due to the nature of this module, in a multi-tenant setting, the configuration in one database -affects all databases in the Odoo instance. +The effect of blacklist domains depends on how the Odoo server is configured to +load databases. In environments where multiple databases can be listed and +accessed, blacklist entries apply across all of them. When the server loads only +a single, explicit database, the blacklist affects only that database. From 62927e478b69784673192d6c8560f93c4d72bb03 Mon Sep 17 00:00:00 2001 From: Aungkokolin1997 Date: Mon, 5 Jan 2026 06:45:25 +0000 Subject: [PATCH 3/6] imp readme --- iap_mail_domain_blacklist/README.rst | 13 +----- .../readme/CONFIGURE.rst | 3 ++ .../readme/DESCRIPTION.rst | 6 +-- .../static/description/index.html | 41 +++++++------------ 4 files changed, 22 insertions(+), 41 deletions(-) diff --git a/iap_mail_domain_blacklist/README.rst b/iap_mail_domain_blacklist/README.rst index 012c667..b97d383 100644 --- a/iap_mail_domain_blacklist/README.rst +++ b/iap_mail_domain_blacklist/README.rst @@ -31,8 +31,8 @@ IAP Mail Domain BlackList This module allows adding domains to the mail domain blacklist to prevent Odoo from assuming that users with the same domain belong to the same organization. -Due to the nature of this module, in a multi-tenant setting, the configuration in one database -affects all databases in the Odoo instance. +Blacklist domains are shared across all effective databases of the server, +which are the databases that this Odoo instance is configured to serve. **Table of contents** @@ -56,15 +56,6 @@ Configuration 2. Search for "Mail Domain Blacklist" and enter the domains you want to blacklist, separated by commas. -Server configuration -~~~~~~~~~~~~~~~~~~~~~ - -In the odoo.conf file, set db_list = True to allow listing all databases. -In this case, blacklist domains from all databases will affect every database. -Set db_list = False and explicitly define db_name if you want to load only -the target database. In this case, blacklist domains will affect only that -database. - Note: Every time you update the "Mail Domain Blacklist," you need to restart the Odoo server for the change to take effect. diff --git a/iap_mail_domain_blacklist/readme/CONFIGURE.rst b/iap_mail_domain_blacklist/readme/CONFIGURE.rst index 39b2f86..4816137 100644 --- a/iap_mail_domain_blacklist/readme/CONFIGURE.rst +++ b/iap_mail_domain_blacklist/readme/CONFIGURE.rst @@ -1,3 +1,6 @@ 1. Go to Settings > General Settings. 2. Search for "Mail Domain Blacklist" and enter the domains you want to blacklist, separated by commas. + +Note: Every time you update the "Mail Domain Blacklist," you need to restart the Odoo server +for the change to take effect. diff --git a/iap_mail_domain_blacklist/readme/DESCRIPTION.rst b/iap_mail_domain_blacklist/readme/DESCRIPTION.rst index 3daa627..aad0fbb 100644 --- a/iap_mail_domain_blacklist/readme/DESCRIPTION.rst +++ b/iap_mail_domain_blacklist/readme/DESCRIPTION.rst @@ -1,7 +1,5 @@ This module allows adding domains to the mail domain blacklist to prevent Odoo from assuming that users with the same domain belong to the same organization. -The effect of blacklist domains depends on how the Odoo server is configured to -load databases. In environments where multiple databases can be listed and -accessed, blacklist entries apply across all of them. When the server loads only -a single, explicit database, the blacklist affects only that database. +Blacklist domains are shared across all effective databases of the server, +which are the databases that this Odoo instance is configured to serve. diff --git a/iap_mail_domain_blacklist/static/description/index.html b/iap_mail_domain_blacklist/static/description/index.html index 05ad3a2..bb68a11 100644 --- a/iap_mail_domain_blacklist/static/description/index.html +++ b/iap_mail_domain_blacklist/static/description/index.html @@ -372,22 +372,19 @@

IAP Mail Domain BlackList

Beta License: AGPL-3 OCA/social Translate me on Weblate Try me on Runboat

This module allows adding domains to the mail domain blacklist to prevent Odoo from assuming that users with the same domain belong to the same organization.

-

Due to the nature of this module, in a multi-tenant setting, the configuration in one database -affects all databases in the Odoo instance.

+

Blacklist domains are shared across all effective databases of the server, +which are the databases that this Odoo instance is configured to serve.

Table of contents

-

Known issues / Roadmap

+

Known issues / Roadmap

Due to a technical limitation, http.db_list() cannot be used during module loading to respect dbfilter, because the HTTP layer is not initialized at that stage. As a result, the module must rely on config.get(‘db_name’) or @@ -428,7 +417,7 @@

Known issues / Roadmap

databases may incorrectly affect active databases.

-

Bug Tracker

+

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed @@ -436,15 +425,15 @@

Bug Tracker

Do not contact contributors directly about support or help with technical issues.

-

Credits

+

Credits

-

Authors

+

Authors

  • Quartile
-

Contributors

+

Contributors

-

Maintainers

+

Maintainers

This module is maintained by the OCA.

Odoo Community Association From dab090f4e584351d16795b8ce99f993e0df217d7 Mon Sep 17 00:00:00 2001 From: Aungkokolin1997 Date: Mon, 5 Jan 2026 11:08:34 +0000 Subject: [PATCH 4/6] imp readme --- iap_mail_domain_blacklist/README.rst | 7 +++++-- iap_mail_domain_blacklist/readme/DESCRIPTION.rst | 7 +++++-- iap_mail_domain_blacklist/static/description/index.html | 6 ++++-- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/iap_mail_domain_blacklist/README.rst b/iap_mail_domain_blacklist/README.rst index b97d383..97c9c1a 100644 --- a/iap_mail_domain_blacklist/README.rst +++ b/iap_mail_domain_blacklist/README.rst @@ -31,8 +31,11 @@ IAP Mail Domain BlackList This module allows adding domains to the mail domain blacklist to prevent Odoo from assuming that users with the same domain belong to the same organization. -Blacklist domains are shared across all effective databases of the server, -which are the databases that this Odoo instance is configured to serve. + +Blacklisted domains are shared across all effective databases on the server. +When the db_name parameter is set, the effective database is assumed to be the +value of that parameter. If db_name is not set and list_db is true, all +databases on the instance are considered effective databases. **Table of contents** diff --git a/iap_mail_domain_blacklist/readme/DESCRIPTION.rst b/iap_mail_domain_blacklist/readme/DESCRIPTION.rst index aad0fbb..47dab94 100644 --- a/iap_mail_domain_blacklist/readme/DESCRIPTION.rst +++ b/iap_mail_domain_blacklist/readme/DESCRIPTION.rst @@ -1,5 +1,8 @@ This module allows adding domains to the mail domain blacklist to prevent Odoo from assuming that users with the same domain belong to the same organization. -Blacklist domains are shared across all effective databases of the server, -which are the databases that this Odoo instance is configured to serve. + +Blacklisted domains are shared across all effective databases on the server. +When the db_name parameter is set, the effective database is assumed to be the +value of that parameter. If db_name is not set and list_db is true, all +databases on the instance are considered effective databases. diff --git a/iap_mail_domain_blacklist/static/description/index.html b/iap_mail_domain_blacklist/static/description/index.html index bb68a11..6a9ba7b 100644 --- a/iap_mail_domain_blacklist/static/description/index.html +++ b/iap_mail_domain_blacklist/static/description/index.html @@ -372,8 +372,10 @@

IAP Mail Domain BlackList

Beta License: AGPL-3 OCA/social Translate me on Weblate Try me on Runboat

This module allows adding domains to the mail domain blacklist to prevent Odoo from assuming that users with the same domain belong to the same organization.

-

Blacklist domains are shared across all effective databases of the server, -which are the databases that this Odoo instance is configured to serve.

+

Blacklisted domains are shared across all effective databases on the server. +When the db_name parameter is set, the effective database is assumed to be the +value of that parameter. If db_name is not set and list_db is true, all +databases on the instance are considered effective databases.

Table of contents

    From dc480447610d31b1e2200e9ca74cb188f9c2169a Mon Sep 17 00:00:00 2001 From: Aungkokolin1997 Date: Tue, 6 Jan 2026 01:32:34 +0000 Subject: [PATCH 5/6] readme --- iap_mail_domain_blacklist/README.rst | 1 - iap_mail_domain_blacklist/readme/DESCRIPTION.rst | 1 - 2 files changed, 2 deletions(-) diff --git a/iap_mail_domain_blacklist/README.rst b/iap_mail_domain_blacklist/README.rst index 97c9c1a..5606d78 100644 --- a/iap_mail_domain_blacklist/README.rst +++ b/iap_mail_domain_blacklist/README.rst @@ -31,7 +31,6 @@ IAP Mail Domain BlackList This module allows adding domains to the mail domain blacklist to prevent Odoo from assuming that users with the same domain belong to the same organization. - Blacklisted domains are shared across all effective databases on the server. When the db_name parameter is set, the effective database is assumed to be the value of that parameter. If db_name is not set and list_db is true, all diff --git a/iap_mail_domain_blacklist/readme/DESCRIPTION.rst b/iap_mail_domain_blacklist/readme/DESCRIPTION.rst index 47dab94..54518a6 100644 --- a/iap_mail_domain_blacklist/readme/DESCRIPTION.rst +++ b/iap_mail_domain_blacklist/readme/DESCRIPTION.rst @@ -1,7 +1,6 @@ This module allows adding domains to the mail domain blacklist to prevent Odoo from assuming that users with the same domain belong to the same organization. - Blacklisted domains are shared across all effective databases on the server. When the db_name parameter is set, the effective database is assumed to be the value of that parameter. If db_name is not set and list_db is true, all From a513bd1dd748b0e72d7dee056f7c0ffebdd7bc11 Mon Sep 17 00:00:00 2001 From: Aungkokolin1997 Date: Tue, 6 Jan 2026 02:07:13 +0000 Subject: [PATCH 6/6] readme --- iap_mail_domain_blacklist/README.rst | 4 ++-- iap_mail_domain_blacklist/readme/DESCRIPTION.rst | 4 ++-- iap_mail_domain_blacklist/static/description/index.html | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/iap_mail_domain_blacklist/README.rst b/iap_mail_domain_blacklist/README.rst index 5606d78..5e9a504 100644 --- a/iap_mail_domain_blacklist/README.rst +++ b/iap_mail_domain_blacklist/README.rst @@ -32,8 +32,8 @@ This module allows adding domains to the mail domain blacklist to prevent Odoo f that users with the same domain belong to the same organization. Blacklisted domains are shared across all effective databases on the server. -When the db_name parameter is set, the effective database is assumed to be the -value of that parameter. If db_name is not set and list_db is true, all +When the db_name parameter is set, the effective databases are assumed to be the +values of that parameter. If db_name is not set and list_db is true, all databases on the instance are considered effective databases. **Table of contents** diff --git a/iap_mail_domain_blacklist/readme/DESCRIPTION.rst b/iap_mail_domain_blacklist/readme/DESCRIPTION.rst index 54518a6..98df39c 100644 --- a/iap_mail_domain_blacklist/readme/DESCRIPTION.rst +++ b/iap_mail_domain_blacklist/readme/DESCRIPTION.rst @@ -2,6 +2,6 @@ This module allows adding domains to the mail domain blacklist to prevent Odoo f that users with the same domain belong to the same organization. Blacklisted domains are shared across all effective databases on the server. -When the db_name parameter is set, the effective database is assumed to be the -value of that parameter. If db_name is not set and list_db is true, all +When the db_name parameter is set, the effective databases are assumed to be the +values of that parameter. If db_name is not set and list_db is true, all databases on the instance are considered effective databases. diff --git a/iap_mail_domain_blacklist/static/description/index.html b/iap_mail_domain_blacklist/static/description/index.html index 6a9ba7b..ae159ee 100644 --- a/iap_mail_domain_blacklist/static/description/index.html +++ b/iap_mail_domain_blacklist/static/description/index.html @@ -373,8 +373,8 @@

    IAP Mail Domain BlackList

    This module allows adding domains to the mail domain blacklist to prevent Odoo from assuming that users with the same domain belong to the same organization.

    Blacklisted domains are shared across all effective databases on the server. -When the db_name parameter is set, the effective database is assumed to be the -value of that parameter. If db_name is not set and list_db is true, all +When the db_name parameter is set, the effective databases are assumed to be the +values of that parameter. If db_name is not set and list_db is true, all databases on the instance are considered effective databases.

    Table of contents