From dcb95aac0707cc66902117a7624f0feee7126dda Mon Sep 17 00:00:00 2001 From: Aungkokolin1997 Date: Wed, 13 Aug 2025 01:33:24 +0000 Subject: [PATCH 1/4] [FIX] mail_message_search : prevent db crash Co-authored-by: Florent de Labarre --- mail_message_search/README.rst | 24 ++++++--- mail_message_search/models/mail_thread.py | 10 +++- mail_message_search/readme/CONFIGURE.md | 7 +++ .../static/description/index.html | 54 +++++++++++-------- 4 files changed, 62 insertions(+), 33 deletions(-) create mode 100644 mail_message_search/readme/CONFIGURE.md diff --git a/mail_message_search/README.rst b/mail_message_search/README.rst index 5d2d36c3f..627b3e01c 100644 --- a/mail_message_search/README.rst +++ b/mail_message_search/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 Message Search =================== @@ -17,7 +13,7 @@ Mail Message Search .. |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%2Fmail-lightgray.png?logo=github @@ -61,6 +57,18 @@ This module uses direct keyword matching across key fields in ``mail.message``, offering more reliable results in multilingual environments. +Configuration +============= + +If your database is very large, you can limit how many messages a search +returns to prevent crashes. + +- Go to Settings ▸ Technical ▸ System Parameters. +- Add a new parameter: + + - Key: mail_message_search.message_limit + - Value: your desired limit (e.g., 5000). + Usage ===== @@ -88,10 +96,10 @@ Authors Contributors ------------ -- `Quartile `__: +- `Quartile `__: - - Aung Ko Ko Lin - - Yoshi Tashiro + - Aung Ko Ko Lin + - Yoshi Tashiro Maintainers ----------- diff --git a/mail_message_search/models/mail_thread.py b/mail_message_search/models/mail_thread.py index 4ce3d3a3b..4789283e3 100644 --- a/mail_message_search/models/mail_thread.py +++ b/mail_message_search/models/mail_thread.py @@ -26,8 +26,14 @@ def _search_message_search(self, operator, value): word_domain_list.append(expression.OR(field_domain_list)) word_domain = expression.AND(word_domain_list) domain = expression.AND([[("model", "=", self._name)], word_domain]) - messages = self.env["mail.message"].search(domain) - return [("id", "in", messages.mapped("res_id"))] + limit_value = ( + self.env["ir.config_parameter"] + .sudo() + .get_param("mail_message_search.message_limit") + ) + limit = int(limit_value) if limit_value else None + messages = self.env["mail.message"]._search(domain, limit=limit) + return [("id", "in", messages.subselect("res_id"))] message_search = fields.Text( help="Message search, to be used only in searches", diff --git a/mail_message_search/readme/CONFIGURE.md b/mail_message_search/readme/CONFIGURE.md new file mode 100644 index 000000000..3bace50dc --- /dev/null +++ b/mail_message_search/readme/CONFIGURE.md @@ -0,0 +1,7 @@ +If your database is very large, you can limit how many messages a search returns to +prevent crashes. + +- Go to Settings ▸ Technical ▸ System Parameters. +- Add a new parameter: + - Key: mail_message_search.message_limit + - Value: your desired limit (e.g., 5000). diff --git a/mail_message_search/static/description/index.html b/mail_message_search/static/description/index.html index e12043477..fe8e64426 100644 --- a/mail_message_search/static/description/index.html +++ b/mail_message_search/static/description/index.html @@ -3,7 +3,7 @@ -README.rst +Mail Message Search -
+ From 718c636e682e7858c4b1faf56c9c659a6b6b026f Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Mon, 22 Dec 2025 14:24:22 +0000 Subject: [PATCH 2/4] [BOT] post-merge updates --- README.md | 2 +- mail_message_search/README.rst | 22 +++++++------ mail_message_search/__manifest__.py | 2 +- .../static/description/index.html | 32 +++++++++++-------- 4 files changed, 34 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index a47a9f6b0..5ad7e8398 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ addon | version | maintainers | summary [mail_force_email_notification](mail_force_email_notification/) | 18.0.1.0.0 | | Context key to define notifications to be sent by emaildefined by force_notification_by_email context key [mail_inline_css](mail_inline_css/) | 18.0.1.0.0 | | Convert style tags in inline style in your mails [mail_layout_preview](mail_layout_preview/) | 18.0.1.0.0 | | Preview email templates in the browser -[mail_message_search](mail_message_search/) | 18.0.1.0.1 | yostashiro aungkokolin1997 | Mail Message Search +[mail_message_search](mail_message_search/) | 18.0.1.0.2 | yostashiro aungkokolin1997 | Mail Message Search [mail_notification_clean_status_error](mail_notification_clean_status_error/) | 18.0.1.0.0 | sebalix | Extend Odoo scheduled action to also delete notifications in error. [mail_notification_custom_subject](mail_notification_custom_subject/) | 18.0.1.0.0 | yajo | Apply a custom subject to mail notifications [mail_optional_autofollow](mail_optional_autofollow/) | 18.0.1.0.0 | | Choose if you want to automatically add new recipients as followers on mail.compose.message diff --git a/mail_message_search/README.rst b/mail_message_search/README.rst index 627b3e01c..7758eeddb 100644 --- a/mail_message_search/README.rst +++ b/mail_message_search/README.rst @@ -1,3 +1,7 @@ +.. image:: https://odoo-community.org/readme-banner-image + :target: https://odoo-community.org/get-involved?utm_source=readme + :alt: Odoo Community Association + =================== Mail Message Search =================== @@ -7,13 +11,13 @@ Mail Message Search !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:5b7a84e863aa1b256584e7696181a8319ccf3fe658eee3ba07567752da997df7 + !! source digest: sha256:349301b4cca46679cb0a86aa50f8fe0018454f85e11325f8ddcb83c4dfdf5e57 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |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/licence-AGPL--3-blue.png +.. |badge2| image:: https://img.shields.io/badge/license-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%2Fmail-lightgray.png?logo=github @@ -63,11 +67,11 @@ Configuration If your database is very large, you can limit how many messages a search returns to prevent crashes. -- Go to Settings ▸ Technical ▸ System Parameters. -- Add a new parameter: +- Go to Settings ▸ Technical ▸ System Parameters. +- Add a new parameter: - - Key: mail_message_search.message_limit - - Value: your desired limit (e.g., 5000). + - Key: mail_message_search.message_limit + - Value: your desired limit (e.g., 5000). Usage ===== @@ -96,10 +100,10 @@ Authors Contributors ------------ -- `Quartile `__: +- `Quartile `__: - - Aung Ko Ko Lin - - Yoshi Tashiro + - Aung Ko Ko Lin + - Yoshi Tashiro Maintainers ----------- diff --git a/mail_message_search/__manifest__.py b/mail_message_search/__manifest__.py index 63abed502..a23cd3e23 100644 --- a/mail_message_search/__manifest__.py +++ b/mail_message_search/__manifest__.py @@ -2,7 +2,7 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). { "name": "Mail Message Search", - "version": "18.0.1.0.1", + "version": "18.0.1.0.2", "author": "Quartile, Odoo Community Association (OCA)", "website": "https://github.com/OCA/mail", "depends": ["mail"], diff --git a/mail_message_search/static/description/index.html b/mail_message_search/static/description/index.html index fe8e64426..038801178 100644 --- a/mail_message_search/static/description/index.html +++ b/mail_message_search/static/description/index.html @@ -3,7 +3,7 @@ -Mail Message Search +README.rst - From 280ebe315aed2648ac17976df68b5270f998231a Mon Sep 17 00:00:00 2001 From: CarlosRoca13 Date: Tue, 23 Dec 2025 17:20:04 +0100 Subject: [PATCH 3/4] [FIX] mail_tracking: Error on tabs without thread open when marking as reviewed Before these changes, when the bus event was received in tabs that did not have the message open, an error appeared because the system was not able to find the message. After these changes, if the message is not available on the screen, the process continues because synchronization will not be necessary, and therefore the error will no longer occur. --- .../static/src/services/mail_core_common_service_patch.esm.js | 1 + 1 file changed, 1 insertion(+) diff --git a/mail_tracking/static/src/services/mail_core_common_service_patch.esm.js b/mail_tracking/static/src/services/mail_core_common_service_patch.esm.js index 2c09f36e8..d5dcbc7f0 100644 --- a/mail_tracking/static/src/services/mail_core_common_service_patch.esm.js +++ b/mail_tracking/static/src/services/mail_core_common_service_patch.esm.js @@ -11,6 +11,7 @@ patch(MailCoreCommon.prototype, { const {message_ids: messageIds} = payload; for (const id of messageIds) { const message = this.store.Message.get({id}); + if (!message) continue; const failedBox = this.store.failed; if (notifId > failedBox.counter_bus_id) { failedBox.counter--; From 040a51f2a06c899c4a7725f47c69b7dd976aa916 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Tue, 23 Dec 2025 16:30:46 +0000 Subject: [PATCH 4/4] [BOT] post-merge updates --- README.md | 2 +- mail_tracking/README.rst | 2 +- mail_tracking/__manifest__.py | 2 +- mail_tracking/static/description/index.html | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 5ad7e8398..8e5b98d4c 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ addon | version | maintainers | summary [mail_send_confirmation](mail_send_confirmation/) | 18.0.1.0.0 | | Mail Send Confirmation [mail_show_follower](mail_show_follower/) | 18.0.1.0.1 | yajo | Show CC document followers in mails. [mail_suggested_recipient_unchecked](mail_suggested_recipient_unchecked/) | 18.0.1.0.0 | victoralmau | Mail suggested recipient unchecked -[mail_tracking](mail_tracking/) | 18.0.1.0.6 | | Email tracking system for all mails sent +[mail_tracking](mail_tracking/) | 18.0.1.0.7 | | Email tracking system for all mails sent [mail_tracking_mailgun](mail_tracking_mailgun/) | 18.0.1.0.0 | | Mail tracking and Mailgun webhooks integration [mail_tracking_mass_mailing](mail_tracking_mass_mailing/) | 18.0.1.0.0 | | Improve mass mailing email tracking diff --git a/mail_tracking/README.rst b/mail_tracking/README.rst index c378cae17..885a7b159 100644 --- a/mail_tracking/README.rst +++ b/mail_tracking/README.rst @@ -11,7 +11,7 @@ Email tracking !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:1f1623a6f08afa9507deebf534e7eb24325927d829724858b58a3c9bb5bc2cb4 + !! source digest: sha256:571d21edf517716228503f485f8ea57c4b818287ac17f38ba2d01b80a3862077 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png diff --git a/mail_tracking/__manifest__.py b/mail_tracking/__manifest__.py index 0ce3008e5..99a6eee55 100644 --- a/mail_tracking/__manifest__.py +++ b/mail_tracking/__manifest__.py @@ -7,7 +7,7 @@ { "name": "Email tracking", "summary": "Email tracking system for all mails sent", - "version": "18.0.1.0.6", + "version": "18.0.1.0.7", "category": "Social Network", "website": "https://github.com/OCA/mail", "author": ("Tecnativa, Odoo Community Association (OCA)"), diff --git a/mail_tracking/static/description/index.html b/mail_tracking/static/description/index.html index 3000021fa..8d16d5b54 100644 --- a/mail_tracking/static/description/index.html +++ b/mail_tracking/static/description/index.html @@ -372,7 +372,7 @@

Email tracking

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:1f1623a6f08afa9507deebf534e7eb24325927d829724858b58a3c9bb5bc2cb4 +!! source digest: sha256:571d21edf517716228503f485f8ea57c4b818287ac17f38ba2d01b80a3862077 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

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

This module shows email notification tracking status for any messages in