From 04a78978ed217e7e48e7526e9a40f0689a4212b9 Mon Sep 17 00:00:00 2001 From: Andreu Orensanz Date: Wed, 10 Dec 2025 16:28:34 +0100 Subject: [PATCH 1/8] [ADD] mail_history_mark_unread --- mail_history_mark_unread/README.rst | 76 ++++ mail_history_mark_unread/__init__.py | 3 + mail_history_mark_unread/__manifest__.py | 19 + mail_history_mark_unread/i18n/es.po | 23 + .../i18n/mail_history_mark_unread.pot | 22 + mail_history_mark_unread/models/__init__.py | 3 + .../models/mail_message.py | 43 ++ mail_history_mark_unread/pyproject.toml | 3 + .../readme/CONTRIBUTORS.md | 2 + .../readme/DESCRIPTION.md | 2 + .../static/description/index.html | 422 ++++++++++++++++++ .../src/mail_core_web_service_patch.esm.js | 37 ++ .../static/src/message_actions_patch.esm.js | 21 + .../static/src/message_service_patch.esm.js | 18 + mail_history_mark_unread/tests/__init__.py | 3 + .../tests/test_set_message_undone.py | 76 ++++ 16 files changed, 773 insertions(+) create mode 100644 mail_history_mark_unread/README.rst create mode 100644 mail_history_mark_unread/__init__.py create mode 100644 mail_history_mark_unread/__manifest__.py create mode 100644 mail_history_mark_unread/i18n/es.po create mode 100644 mail_history_mark_unread/i18n/mail_history_mark_unread.pot create mode 100644 mail_history_mark_unread/models/__init__.py create mode 100644 mail_history_mark_unread/models/mail_message.py create mode 100644 mail_history_mark_unread/pyproject.toml create mode 100644 mail_history_mark_unread/readme/CONTRIBUTORS.md create mode 100644 mail_history_mark_unread/readme/DESCRIPTION.md create mode 100644 mail_history_mark_unread/static/description/index.html create mode 100644 mail_history_mark_unread/static/src/mail_core_web_service_patch.esm.js create mode 100644 mail_history_mark_unread/static/src/message_actions_patch.esm.js create mode 100644 mail_history_mark_unread/static/src/message_service_patch.esm.js create mode 100644 mail_history_mark_unread/tests/__init__.py create mode 100644 mail_history_mark_unread/tests/test_set_message_undone.py diff --git a/mail_history_mark_unread/README.rst b/mail_history_mark_unread/README.rst new file mode 100644 index 0000000000..0d4e900d0a --- /dev/null +++ b/mail_history_mark_unread/README.rst @@ -0,0 +1,76 @@ +=========================== +Mail History Mark as Unread +=========================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:3d15e474ebf469d63dc816ff4237c6ee458f9912c887bd9e0af36051da357c7e + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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 + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github + :target: https://github.com/OCA/social/tree/17.0/mail_history_mark_unread + :alt: OCA/social +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/social-17-0/social-17-0-mail_history_mark_unread + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/social&target_branch=17.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module introduces a "Mark as Unread" button for messages in the +History mailbox of the Discuss App. When done the message is restored +back to the Inbox, just like if it were a new unread message, and +disappears from the History mailbox. + +**Table of contents** + +.. contents:: + :local: + +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 +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Contributors +------------ + +- `ForgeFlow `__: + + - Andreu Orensanz + +Maintainers +----------- + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +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. + +This module is part of the `OCA/social `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/mail_history_mark_unread/__init__.py b/mail_history_mark_unread/__init__.py new file mode 100644 index 0000000000..83e553ac46 --- /dev/null +++ b/mail_history_mark_unread/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import models diff --git a/mail_history_mark_unread/__manifest__.py b/mail_history_mark_unread/__manifest__.py new file mode 100644 index 0000000000..c1d433b9a8 --- /dev/null +++ b/mail_history_mark_unread/__manifest__.py @@ -0,0 +1,19 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +{ + "name": "Mail History Mark as Unread", + "summary": "Add 'Mark as Unread' action to messages in History mailbox", + "version": "17.0.1.0.0", + "category": "Social Network", + "website": "https://github.com/OCA/social", + "author": "Odoo Community Association (OCA)", + "license": "AGPL-3", + "installable": True, + "depends": ["mail"], + "assets": { + "web.assets_backend": [ + "mail_history_mark_unread/static/src/message_actions_patch.esm.js", + "mail_history_mark_unread/static/src/message_service_patch.esm.js", + "mail_history_mark_unread/static/src/mail_core_web_service_patch.esm.js", + ], + }, +} diff --git a/mail_history_mark_unread/i18n/es.po b/mail_history_mark_unread/i18n/es.po new file mode 100644 index 0000000000..ecedc74827 --- /dev/null +++ b/mail_history_mark_unread/i18n/es.po @@ -0,0 +1,23 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_history_mark_unread +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 17.0+e\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-12-10 14:56+0000\n" +"PO-Revision-Date: 2025-12-10 14:56+0000\n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: mail_history_mark_unread +#. odoo-javascript +#: code:addons/mail_history_mark_unread/static/src/core/common/message_actions_patch.js:0 +#, python-format +msgid "Mark as Unread" +msgstr "Marcar como no leído" diff --git a/mail_history_mark_unread/i18n/mail_history_mark_unread.pot b/mail_history_mark_unread/i18n/mail_history_mark_unread.pot new file mode 100644 index 0000000000..221bf3efcc --- /dev/null +++ b/mail_history_mark_unread/i18n/mail_history_mark_unread.pot @@ -0,0 +1,22 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_history_mark_unread +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 17.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-12-10 14:41:00+0000\n" +"PO-Revision-Date: 2024-12-10 14:41:00+0000\n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: mail_history_mark_unread +#: code:addons/mail_history_mark_unread/static/src/core/common/message_actions_patch.js:0 +#, python-format +msgid "Mark as Unread" +msgstr "" diff --git a/mail_history_mark_unread/models/__init__.py b/mail_history_mark_unread/models/__init__.py new file mode 100644 index 0000000000..e5f3405d68 --- /dev/null +++ b/mail_history_mark_unread/models/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import mail_message diff --git a/mail_history_mark_unread/models/mail_message.py b/mail_history_mark_unread/models/mail_message.py new file mode 100644 index 0000000000..ff0017c320 --- /dev/null +++ b/mail_history_mark_unread/models/mail_message.py @@ -0,0 +1,43 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import models + + +class MailMessage(models.Model): + _inherit = "mail.message" + + def set_message_undone(self): + """ + Reverses the effect of set_message_done() by: + - Setting is_read to False on the notification + - Moving the message from History back to Inbox + - Updating the needaction counter + """ + partner_id = self.env.user.partner_id + + notifications = ( + self.env["mail.notification"] + .sudo() + .search( + [ + ("mail_message_id", "in", self.ids), + ("res_partner_id", "=", partner_id.id), + ("is_read", "=", True), + ] + ) + ) + + if not notifications: + return + + notifications.write({"is_read": False}) + + counter = self.env.user.partner_id._get_needaction_count() + self.env["bus.bus"]._sendone( + partner_id, + "mail.message/mark_as_unread", + { + "message_ids": notifications.mail_message_id.ids, + "needaction_inbox_counter": counter, + }, + ) diff --git a/mail_history_mark_unread/pyproject.toml b/mail_history_mark_unread/pyproject.toml new file mode 100644 index 0000000000..4231d0cccb --- /dev/null +++ b/mail_history_mark_unread/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/mail_history_mark_unread/readme/CONTRIBUTORS.md b/mail_history_mark_unread/readme/CONTRIBUTORS.md new file mode 100644 index 0000000000..313a35836a --- /dev/null +++ b/mail_history_mark_unread/readme/CONTRIBUTORS.md @@ -0,0 +1,2 @@ +- [ForgeFlow](https://www.forgeflow.com): + - Andreu Orensanz \<\> diff --git a/mail_history_mark_unread/readme/DESCRIPTION.md b/mail_history_mark_unread/readme/DESCRIPTION.md new file mode 100644 index 0000000000..9811d3992d --- /dev/null +++ b/mail_history_mark_unread/readme/DESCRIPTION.md @@ -0,0 +1,2 @@ +This module introduces a "Mark as Unread" button for messages in the History mailbox of the Discuss App. +When done the message is restored back to the Inbox, just like if it were a new unread message, and disappears from the History mailbox. diff --git a/mail_history_mark_unread/static/description/index.html b/mail_history_mark_unread/static/description/index.html new file mode 100644 index 0000000000..04a6984863 --- /dev/null +++ b/mail_history_mark_unread/static/description/index.html @@ -0,0 +1,422 @@ + + + + + +Mail History Mark as Unread + + + +
+

Mail History Mark as Unread

+ + +

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

+

This module introduces a “Mark as Unread” button for messages in the +History mailbox of the Discuss App. When done the message is restored +back to the Inbox, just like if it were a new unread message, and +disappears from the History mailbox.

+

Table of contents

+ +
+

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 +feedback.

+

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

+
+
+

Credits

+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+ +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.

+

This module is part of the OCA/social project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/mail_history_mark_unread/static/src/mail_core_web_service_patch.esm.js b/mail_history_mark_unread/static/src/mail_core_web_service_patch.esm.js new file mode 100644 index 0000000000..e68ebaec13 --- /dev/null +++ b/mail_history_mark_unread/static/src/mail_core_web_service_patch.esm.js @@ -0,0 +1,37 @@ +/* @odoo-module */ + +import {MailCoreWeb} from "@mail/core/web/mail_core_web_service"; +import {patch} from "@web/core/utils/patch"; + +patch(MailCoreWeb.prototype, { + setup() { + super.setup(); + this.busService.subscribe("mail.message/mark_as_unread", (payload) => { + const {message_ids: messageIds, needaction_inbox_counter} = payload; + const inbox = this.store.discuss.inbox; + const history = this.store.discuss.history; + + for (const messageId of messageIds) { + const message = this.store.Message.get(messageId); + if (!message) { + continue; + } + const originThread = message.originThread; + if (originThread && !message.isNeedaction) { + originThread.message_needaction_counter++; + originThread.needactionMessages.add(message); + } + if ( + this.store.user && + !message.needaction_partner_ids.includes(this.store.user.id) + ) { + message.needaction_partner_ids.push(this.store.user.id); + } + // Move message from History to Inbox + history.messages.delete({id: messageId}); + inbox.messages.add(message); + } + inbox.counter = needaction_inbox_counter; + }); + }, +}); diff --git a/mail_history_mark_unread/static/src/message_actions_patch.esm.js b/mail_history_mark_unread/static/src/message_actions_patch.esm.js new file mode 100644 index 0000000000..a585bb0d94 --- /dev/null +++ b/mail_history_mark_unread/static/src/message_actions_patch.esm.js @@ -0,0 +1,21 @@ +/* @odoo-module */ + +import {_t} from "@web/core/l10n/translation"; +import {messageActionsRegistry} from "@mail/core/common/message_actions"; + +// Add "Mark as Unread" action for messages in History mailbox +messageActionsRegistry.add("mark-as-unread-history", { + condition: (component) => { + return ( + component.props.message?.isHistory && + component.store.user && + component.props.message.persistent + ); + }, + icon: "fa-eye-slash", + title: _t("Mark as Unread"), + onClick: (component) => { + component.messageService.setUndone(component.props.message); + }, + sequence: 15, +}); diff --git a/mail_history_mark_unread/static/src/message_service_patch.esm.js b/mail_history_mark_unread/static/src/message_service_patch.esm.js new file mode 100644 index 0000000000..855b218a0f --- /dev/null +++ b/mail_history_mark_unread/static/src/message_service_patch.esm.js @@ -0,0 +1,18 @@ +/* @odoo-module */ + +import {MessageService} from "@mail/core/common/message_service"; +import {patch} from "@web/core/utils/patch"; + +patch(MessageService.prototype, { + /** + * Mark a message as unread for the current user. + * This moves the message from History back to Inbox. + * + * @param {Object} message - The message to mark as unread + */ + async setUndone(message) { + await this.orm.silent.call("mail.message", "set_message_undone", [ + [message.id], + ]); + }, +}); diff --git a/mail_history_mark_unread/tests/__init__.py b/mail_history_mark_unread/tests/__init__.py new file mode 100644 index 0000000000..2942e2a310 --- /dev/null +++ b/mail_history_mark_unread/tests/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import test_set_message_undone diff --git a/mail_history_mark_unread/tests/test_set_message_undone.py b/mail_history_mark_unread/tests/test_set_message_undone.py new file mode 100644 index 0000000000..962827ec5f --- /dev/null +++ b/mail_history_mark_unread/tests/test_set_message_undone.py @@ -0,0 +1,76 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from unittest.mock import patch + +from odoo.addons.base.tests.common import SavepointCaseWithUserDemo + + +class TestSetMessageUndone(SavepointCaseWithUserDemo): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.partner = cls.env["res.partner"].create({"name": "Test Partner"}) + + def test_01_set_message_undone_marks_notification_unread_and_sends_bus(self): + message = self.env["mail.message"].create( + { + "model": "res.partner", + "res_id": self.partner.id, + "body": "message in history", + "message_type": "comment", + "subtype_id": self.env.ref("mail.mt_comment").id, + } + ) + notification = self.env["mail.notification"].create( + { + "mail_message_id": message.id, + "notification_status": "sent", + "notification_type": "inbox", + "res_partner_id": self.env.user.partner_id.id, + "is_read": True, + } + ) + self.assertTrue(notification.is_read) + + with patch.object( + type(self.env["bus.bus"]), "_sendone", autospec=True + ) as mocked_sendone: + message.set_message_undone() + + notification.invalidate_recordset(["is_read"]) + self.assertFalse(notification.is_read) + + expected_counter = self.env.user.partner_id._get_needaction_count() + mocked_sendone.assert_called_once() + _self, target, notification_type, payload = mocked_sendone.call_args.args + self.assertEqual(target, self.env.user.partner_id) + self.assertEqual(notification_type, "mail.message/mark_as_unread") + self.assertEqual(payload.get("message_ids"), [message.id]) + self.assertEqual(payload.get("needaction_inbox_counter"), expected_counter) + + def test_02_set_message_undone_noop_when_no_read_notification(self): + message = self.env["mail.message"].create( + { + "model": "res.partner", + "res_id": self.partner.id, + "body": "message without read notification", + "message_type": "comment", + "subtype_id": self.env.ref("mail.mt_comment").id, + } + ) + # Notification exists but is already unread + self.env["mail.notification"].create( + { + "mail_message_id": message.id, + "notification_status": "sent", + "notification_type": "inbox", + "res_partner_id": self.env.user.partner_id.id, + "is_read": False, + } + ) + + with patch.object( + type(self.env["bus.bus"]), "_sendone", autospec=True + ) as mocked_sendone: + message.set_message_undone() + mocked_sendone.assert_not_called() From 637235ceef34047f789d6b5f9cd61946b8f14d83 Mon Sep 17 00:00:00 2001 From: oca-ci Date: Sat, 13 Dec 2025 13:45:56 +0000 Subject: [PATCH 2/8] [UPD] Update mail_history_mark_unread.pot --- .../i18n/mail_history_mark_unread.pot | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/mail_history_mark_unread/i18n/mail_history_mark_unread.pot b/mail_history_mark_unread/i18n/mail_history_mark_unread.pot index 221bf3efcc..9ea72f57ca 100644 --- a/mail_history_mark_unread/i18n/mail_history_mark_unread.pot +++ b/mail_history_mark_unread/i18n/mail_history_mark_unread.pot @@ -6,8 +6,6 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 17.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-12-10 14:41:00+0000\n" -"PO-Revision-Date: 2024-12-10 14:41:00+0000\n" "Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -16,7 +14,13 @@ msgstr "" "Plural-Forms: \n" #. module: mail_history_mark_unread -#: code:addons/mail_history_mark_unread/static/src/core/common/message_actions_patch.js:0 +#. odoo-javascript +#: code:addons/mail_history_mark_unread/static/src/message_actions_patch.esm.js:0 #, python-format msgid "Mark as Unread" msgstr "" + +#. module: mail_history_mark_unread +#: model:ir.model,name:mail_history_mark_unread.model_mail_message +msgid "Message" +msgstr "" From 94905ae88514a15a53ffbbdc2e0620ec3f48862d Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Sat, 13 Dec 2025 13:50:57 +0000 Subject: [PATCH 3/8] [BOT] post-merge updates --- .../static/description/icon.png | Bin 0 -> 10254 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 mail_history_mark_unread/static/description/icon.png diff --git a/mail_history_mark_unread/static/description/icon.png b/mail_history_mark_unread/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..1dcc49c24f364e9adf0afbc6fc0bac6dbecdeb11 GIT binary patch literal 10254 zcmbt)WmufcvhH9Zc!C8B?l8#UE&&o;gF7=g3=D(IAOS+K1lK^25Zv7%L4sRw_uvvF z*qyAk?>c**=lnR&y+1yw{;I3Hy6Ua2{<d0kcR+VvBo; zA_X`>;1;xAPL9rQqFxd#f5{a^zW*uaW+r3+U{|fRunu`GZhy$X z8_|Zi{zd#vIokczl8Xh*4Wi@i0+C?Rg1AB5VOEg8B>buLFCi~r5DPd2ED7QP2>^LO z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!-Y-4lJdb34*k({@M zJ5!9Di^||~(IZ4iOoAbtggao+CaYvJynmB^;4r-tY2gS_*P!?U?hlEX;l+^*{%B2n z)|1j9wOHQQ^5Xha>{Cu8_w^8=#6;Dz7kU~RgTqn;ynDm6{xdlkf2vk0UK^oS3yVy4 zE+v&qnlYtPHBk#X&2}r7`@K`J@^e~Qm?iRJ*tbAaZDZTmB&mWMkZp7Kj7^kth#_uX z5z>gC(8Xz|Ie(+#&wiF3;Aey|Db(R*-U)!6;l_5@u?-$>j0SgEl5+c}Lfe-$p-dFH zB_$bC<)x6#A_2Uuo8=^l1@}vK!gvbF#b&MoH8ac3xMxUz$LFb8KU(x$YhtHanM_sw zYOFMBX2iNNSe&a}!;G9nv(tsW4@%3iQcqczOCF*JOBQ@4Orw=o?_vc(9$hfO`>U6& zyY_CUa9pASiJpmv`@oR!k;&$`h8!)$uS=}d-fPddfIdMDUW@%3y1LI(1Q=e$)sz(QC*E;Nfl99YTgk+|@jl`+iF?<_D?4YqV0Zl)lO8YWC@1ZWW^mi{5ePQN<~FQ2NMG$|K{py5akJa zkezmqhN)>MGMp$7=sOo2(7ppv``dCIwf&MaQQis7S596kkiw8Do(jO?EY4iJ4Hec6 z4Hymzu`w)cI9Pbq6GPtTP)x&Lmk;FT=ZCB4>(5}c0?;2l`p&?>&<;2(P8a3lOTNP# zdEzF5qDpkRR&PZC&cS{7xD@qV;(g5X%xI?m$9Q Date: Sun, 14 Dec 2025 18:53:37 +0000 Subject: [PATCH 4/8] Added translation using Weblate (Italian) --- mail_history_mark_unread/i18n/it.po | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 mail_history_mark_unread/i18n/it.po diff --git a/mail_history_mark_unread/i18n/it.po b/mail_history_mark_unread/i18n/it.po new file mode 100644 index 0000000000..359862884b --- /dev/null +++ b/mail_history_mark_unread/i18n/it.po @@ -0,0 +1,27 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_history_mark_unread +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 17.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" + +#. module: mail_history_mark_unread +#. odoo-javascript +#: code:addons/mail_history_mark_unread/static/src/message_actions_patch.esm.js:0 +#, python-format +msgid "Mark as Unread" +msgstr "" + +#. module: mail_history_mark_unread +#: model:ir.model,name:mail_history_mark_unread.model_mail_message +msgid "Message" +msgstr "" From aa2c6c65c26c46d315904e26cff5a3591c2a23fa Mon Sep 17 00:00:00 2001 From: mymage Date: Thu, 18 Dec 2025 07:20:52 +0000 Subject: [PATCH 5/8] Translated using Weblate (Italian) Currently translated at 100.0% (2 of 2 strings) Translation: social-17.0/social-17.0-mail_history_mark_unread Translate-URL: https://translation.odoo-community.org/projects/social-17-0/social-17-0-mail_history_mark_unread/it/ --- mail_history_mark_unread/i18n/it.po | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mail_history_mark_unread/i18n/it.po b/mail_history_mark_unread/i18n/it.po index 359862884b..9df621a848 100644 --- a/mail_history_mark_unread/i18n/it.po +++ b/mail_history_mark_unread/i18n/it.po @@ -6,22 +6,24 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 17.0\n" "Report-Msgid-Bugs-To: \n" -"Last-Translator: Automatically generated\n" +"PO-Revision-Date: 2025-12-18 08:06+0000\n" +"Last-Translator: mymage \n" "Language-Team: none\n" "Language: it\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" "Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 5.10.4\n" #. module: mail_history_mark_unread #. odoo-javascript #: code:addons/mail_history_mark_unread/static/src/message_actions_patch.esm.js:0 #, python-format msgid "Mark as Unread" -msgstr "" +msgstr "Segna da leggere" #. module: mail_history_mark_unread #: model:ir.model,name:mail_history_mark_unread.model_mail_message msgid "Message" -msgstr "" +msgstr "Messaggio" From 041bf1284a117d27a89acace07572e76eead4cd2 Mon Sep 17 00:00:00 2001 From: Andreu Orensanz Date: Wed, 14 Jan 2026 16:18:02 +0100 Subject: [PATCH 6/8] [IMP] mail_history_mark_unread: enable marking notifications as unread from search panel in Discuss app --- mail_history_mark_unread/README.rst | 10 ++++-- mail_history_mark_unread/__manifest__.py | 4 ++- .../readme/DESCRIPTION.md | 4 ++- .../static/description/index.html | 9 ++++-- .../static/src/message_actions_patch.esm.js | 32 ++++++++++++++----- .../static/src/message_card_list.xml | 9 ++++++ 6 files changed, 52 insertions(+), 16 deletions(-) create mode 100644 mail_history_mark_unread/static/src/message_card_list.xml diff --git a/mail_history_mark_unread/README.rst b/mail_history_mark_unread/README.rst index 0d4e900d0a..b38e071ea1 100644 --- a/mail_history_mark_unread/README.rst +++ b/mail_history_mark_unread/README.rst @@ -29,9 +29,13 @@ Mail History Mark as Unread |badge1| |badge2| |badge3| |badge4| |badge5| This module introduces a "Mark as Unread" button for messages in the -History mailbox of the Discuss App. When done the message is restored -back to the Inbox, just like if it were a new unread message, and -disappears from the History mailbox. +History mailbox and Search results of the Discuss App. When done the +message is restored back to the Inbox, just like if it were a new unread +message, and disappears from the History mailbox. + +The button is also available in the Search Messages panel (accessible +via the search icon in Discuss), allowing users to mark any searched +message as unread directly from the search results. **Table of contents** diff --git a/mail_history_mark_unread/__manifest__.py b/mail_history_mark_unread/__manifest__.py index c1d433b9a8..1235cf989f 100644 --- a/mail_history_mark_unread/__manifest__.py +++ b/mail_history_mark_unread/__manifest__.py @@ -1,7 +1,8 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { "name": "Mail History Mark as Unread", - "summary": "Add 'Mark as Unread' action to messages in History mailbox", + "summary": """Add 'Mark as Unread' action to messages in History mailbox + and Search results""", "version": "17.0.1.0.0", "category": "Social Network", "website": "https://github.com/OCA/social", @@ -14,6 +15,7 @@ "mail_history_mark_unread/static/src/message_actions_patch.esm.js", "mail_history_mark_unread/static/src/message_service_patch.esm.js", "mail_history_mark_unread/static/src/mail_core_web_service_patch.esm.js", + "mail_history_mark_unread/static/src/message_card_list.xml", ], }, } diff --git a/mail_history_mark_unread/readme/DESCRIPTION.md b/mail_history_mark_unread/readme/DESCRIPTION.md index 9811d3992d..7d7a72f78e 100644 --- a/mail_history_mark_unread/readme/DESCRIPTION.md +++ b/mail_history_mark_unread/readme/DESCRIPTION.md @@ -1,2 +1,4 @@ -This module introduces a "Mark as Unread" button for messages in the History mailbox of the Discuss App. +This module introduces a "Mark as Unread" button for messages in the History mailbox and Search results of the Discuss App. When done the message is restored back to the Inbox, just like if it were a new unread message, and disappears from the History mailbox. + +The button is also available in the Search Messages panel (accessible via the search icon in Discuss), allowing users to mark any searched message as unread directly from the search results. diff --git a/mail_history_mark_unread/static/description/index.html b/mail_history_mark_unread/static/description/index.html index 04a6984863..8aa45ff7a0 100644 --- a/mail_history_mark_unread/static/description/index.html +++ b/mail_history_mark_unread/static/description/index.html @@ -371,9 +371,12 @@

Mail History Mark as Unread

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

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

This module introduces a “Mark as Unread” button for messages in the -History mailbox of the Discuss App. When done the message is restored -back to the Inbox, just like if it were a new unread message, and -disappears from the History mailbox.

+History mailbox and Search results of the Discuss App. When done the +message is restored back to the Inbox, just like if it were a new unread +message, and disappears from the History mailbox.

+

The button is also available in the Search Messages panel (accessible +via the search icon in Discuss), allowing users to mark any searched +message as unread directly from the search results.

Table of contents

    diff --git a/mail_history_mark_unread/static/src/message_actions_patch.esm.js b/mail_history_mark_unread/static/src/message_actions_patch.esm.js index a585bb0d94..fd2c21ad7d 100644 --- a/mail_history_mark_unread/static/src/message_actions_patch.esm.js +++ b/mail_history_mark_unread/static/src/message_actions_patch.esm.js @@ -3,19 +3,35 @@ import {_t} from "@web/core/l10n/translation"; import {messageActionsRegistry} from "@mail/core/common/message_actions"; -// Add "Mark as Unread" action for messages in History mailbox +// Add "Mark as Unread" action for messages in History mailbox and Search results messageActionsRegistry.add("mark-as-unread-history", { condition: (component) => { - return ( - component.props.message?.isHistory && - component.store.user && - component.props.message.persistent - ); + const message = component.props.message; + if (!message?.persistent || !component.store.user) { + return false; + } + if (message.isHistory) { + return true; + } + if (component.env.messageCard && !message.isNeedaction) { + return true; + } + return false; }, icon: "fa-eye-slash", title: _t("Mark as Unread"), - onClick: (component) => { - component.messageService.setUndone(component.props.message); + onClick: async (component) => { + const message = component.props.message; + await component.messageService.setUndone(message); + // Remove from search results if in search mode + const messageSearch = component.props.messageSearch; + if (messageSearch?.messages) { + const index = messageSearch.messages.findIndex((m) => m.id === message.id); + if (index !== -1) { + messageSearch.messages.splice(index, 1); + messageSearch.count = Math.max(0, messageSearch.count - 1); + } + } }, sequence: 15, }); diff --git a/mail_history_mark_unread/static/src/message_card_list.xml b/mail_history_mark_unread/static/src/message_card_list.xml new file mode 100644 index 0000000000..879d27fa72 --- /dev/null +++ b/mail_history_mark_unread/static/src/message_card_list.xml @@ -0,0 +1,9 @@ + + + + + + props.mode === 'search' + + + From 261eda31c3729e3a44dcb27e3c861eea92ca61e0 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Thu, 7 May 2026 08:00:42 +0000 Subject: [PATCH 7/8] [BOT] post-merge updates --- mail_history_mark_unread/README.rst | 12 ++++++---- mail_history_mark_unread/__manifest__.py | 2 +- .../static/description/index.html | 24 ++++++++++++------- 3 files changed, 24 insertions(+), 14 deletions(-) diff --git a/mail_history_mark_unread/README.rst b/mail_history_mark_unread/README.rst index b38e071ea1..8954a046f0 100644 --- a/mail_history_mark_unread/README.rst +++ b/mail_history_mark_unread/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 History Mark as Unread =========================== @@ -7,13 +11,13 @@ Mail History Mark as Unread !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:3d15e474ebf469d63dc816ff4237c6ee458f9912c887bd9e0af36051da357c7e + !! source digest: sha256:3f8e69e93e8dfa080108bf1714a0349710c7ebdfc9988525a5a523218a1159fa !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |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%2Fsocial-lightgray.png?logo=github @@ -58,9 +62,9 @@ Credits Contributors ------------ -- `ForgeFlow `__: +- `ForgeFlow `__: - - Andreu Orensanz + - Andreu Orensanz Maintainers ----------- diff --git a/mail_history_mark_unread/__manifest__.py b/mail_history_mark_unread/__manifest__.py index 1235cf989f..9531356ab2 100644 --- a/mail_history_mark_unread/__manifest__.py +++ b/mail_history_mark_unread/__manifest__.py @@ -3,7 +3,7 @@ "name": "Mail History Mark as Unread", "summary": """Add 'Mark as Unread' action to messages in History mailbox and Search results""", - "version": "17.0.1.0.0", + "version": "17.0.1.1.0", "category": "Social Network", "website": "https://github.com/OCA/social", "author": "Odoo Community Association (OCA)", diff --git a/mail_history_mark_unread/static/description/index.html b/mail_history_mark_unread/static/description/index.html index 8aa45ff7a0..079172a571 100644 --- a/mail_history_mark_unread/static/description/index.html +++ b/mail_history_mark_unread/static/description/index.html @@ -3,7 +3,7 @@ -Mail History Mark as Unread +README.rst -
    -

    Mail History Mark as Unread

    +
    + + +Odoo Community Association + +
    +

    Mail History Mark as Unread

    -

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

    +

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

    This module introduces a “Mark as Unread” button for messages in the History mailbox and Search results of the Discuss App. When done the message is restored back to the Inbox, just like if it were a new unread @@ -389,7 +394,7 @@

    Mail History Mark as Unread

-

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 @@ -397,9 +402,9 @@

Bug Tracker

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

+ From 17134e2759cc31dfc03f634ef10077a0e0d86281 Mon Sep 17 00:00:00 2001 From: GuillermoNforgeflow Date: Thu, 9 Jul 2026 08:13:16 +0200 Subject: [PATCH 8/8] [MIG] mail_history_mark_unread: Migration to 19.0 --- mail_history_mark_unread/README.rst | 10 +++---- mail_history_mark_unread/__manifest__.py | 4 +-- .../models/mail_message.py | 5 ++-- .../static/description/index.html | 6 ++--- .../src/mail_core_web_service_patch.esm.js | 25 ++++++------------ .../static/src/message_actions_patch.esm.js | 26 ++++++++----------- .../static/src/message_model_patch.esm.js | 17 ++++++++++++ .../static/src/message_service_patch.esm.js | 18 ------------- .../tests/test_set_message_undone.py | 19 +++++++------- 9 files changed, 57 insertions(+), 73 deletions(-) create mode 100644 mail_history_mark_unread/static/src/message_model_patch.esm.js delete mode 100644 mail_history_mark_unread/static/src/message_service_patch.esm.js diff --git a/mail_history_mark_unread/README.rst b/mail_history_mark_unread/README.rst index 8954a046f0..878c02a84e 100644 --- a/mail_history_mark_unread/README.rst +++ b/mail_history_mark_unread/README.rst @@ -21,13 +21,13 @@ Mail History Mark as Unread :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github - :target: https://github.com/OCA/social/tree/17.0/mail_history_mark_unread + :target: https://github.com/OCA/social/tree/19.0/mail_history_mark_unread :alt: OCA/social .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/social-17-0/social-17-0-mail_history_mark_unread + :target: https://translation.odoo-community.org/projects/social-19-0/social-19-0-mail_history_mark_unread :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png - :target: https://runboat.odoo-community.org/builds?repo=OCA/social&target_branch=17.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/social&target_branch=19.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| @@ -52,7 +52,7 @@ 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 -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -79,6 +79,6 @@ 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. -This module is part of the `OCA/social `_ project on GitHub. +This module is part of the `OCA/social `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/mail_history_mark_unread/__manifest__.py b/mail_history_mark_unread/__manifest__.py index 9531356ab2..30a9304cd8 100644 --- a/mail_history_mark_unread/__manifest__.py +++ b/mail_history_mark_unread/__manifest__.py @@ -3,7 +3,7 @@ "name": "Mail History Mark as Unread", "summary": """Add 'Mark as Unread' action to messages in History mailbox and Search results""", - "version": "17.0.1.1.0", + "version": "19.0.1.0.0", "category": "Social Network", "website": "https://github.com/OCA/social", "author": "Odoo Community Association (OCA)", @@ -13,7 +13,7 @@ "assets": { "web.assets_backend": [ "mail_history_mark_unread/static/src/message_actions_patch.esm.js", - "mail_history_mark_unread/static/src/message_service_patch.esm.js", + "mail_history_mark_unread/static/src/message_model_patch.esm.js", "mail_history_mark_unread/static/src/mail_core_web_service_patch.esm.js", "mail_history_mark_unread/static/src/message_card_list.xml", ], diff --git a/mail_history_mark_unread/models/mail_message.py b/mail_history_mark_unread/models/mail_message.py index ff0017c320..2dc6ad8030 100644 --- a/mail_history_mark_unread/models/mail_message.py +++ b/mail_history_mark_unread/models/mail_message.py @@ -32,9 +32,8 @@ def set_message_undone(self): notifications.write({"is_read": False}) - counter = self.env.user.partner_id._get_needaction_count() - self.env["bus.bus"]._sendone( - partner_id, + counter = partner_id._get_needaction_count() + self.env.user._bus_send( "mail.message/mark_as_unread", { "message_ids": notifications.mail_message_id.ids, diff --git a/mail_history_mark_unread/static/description/index.html b/mail_history_mark_unread/static/description/index.html index 079172a571..454643175b 100644 --- a/mail_history_mark_unread/static/description/index.html +++ b/mail_history_mark_unread/static/description/index.html @@ -374,7 +374,7 @@

Mail History Mark as Unread

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! source digest: sha256:3f8e69e93e8dfa080108bf1714a0349710c7ebdfc9988525a5a523218a1159fa !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

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

+

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

This module introduces a “Mark as Unread” button for messages in the History mailbox and Search results of the Discuss App. When done the message is restored back to the Inbox, just like if it were a new unread @@ -398,7 +398,7 @@

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 -feedback.

+feedback.

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

@@ -421,7 +421,7 @@

Maintainers

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.

-

This module is part of the OCA/social project on GitHub.

+

This module is part of the OCA/social project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

diff --git a/mail_history_mark_unread/static/src/mail_core_web_service_patch.esm.js b/mail_history_mark_unread/static/src/mail_core_web_service_patch.esm.js index e68ebaec13..b6b767f7e1 100644 --- a/mail_history_mark_unread/static/src/mail_core_web_service_patch.esm.js +++ b/mail_history_mark_unread/static/src/mail_core_web_service_patch.esm.js @@ -1,5 +1,3 @@ -/* @odoo-module */ - import {MailCoreWeb} from "@mail/core/web/mail_core_web_service"; import {patch} from "@web/core/utils/patch"; @@ -8,26 +6,19 @@ patch(MailCoreWeb.prototype, { super.setup(); this.busService.subscribe("mail.message/mark_as_unread", (payload) => { const {message_ids: messageIds, needaction_inbox_counter} = payload; - const inbox = this.store.discuss.inbox; - const history = this.store.discuss.history; - + const inbox = this.store.inbox; + const history = this.store.history; for (const messageId of messageIds) { - const message = this.store.Message.get(messageId); + const message = this.store["mail.message"].get(messageId); if (!message) { continue; } - const originThread = message.originThread; - if (originThread && !message.isNeedaction) { - originThread.message_needaction_counter++; - originThread.needactionMessages.add(message); - } - if ( - this.store.user && - !message.needaction_partner_ids.includes(this.store.user.id) - ) { - message.needaction_partner_ids.push(this.store.user.id); + const thread = message.thread; + if (thread && !message.needaction) { + thread.message_needaction_counter++; } - // Move message from History to Inbox + message.needaction = true; + // Move message from History back to Inbox history.messages.delete({id: messageId}); inbox.messages.add(message); } diff --git a/mail_history_mark_unread/static/src/message_actions_patch.esm.js b/mail_history_mark_unread/static/src/message_actions_patch.esm.js index fd2c21ad7d..0147b2e93d 100644 --- a/mail_history_mark_unread/static/src/message_actions_patch.esm.js +++ b/mail_history_mark_unread/static/src/message_actions_patch.esm.js @@ -1,30 +1,26 @@ -/* @odoo-module */ - import {_t} from "@web/core/l10n/translation"; -import {messageActionsRegistry} from "@mail/core/common/message_actions"; +import {registerMessageAction} from "@mail/core/common/message_actions"; // Add "Mark as Unread" action for messages in History mailbox and Search results -messageActionsRegistry.add("mark-as-unread-history", { - condition: (component) => { - const message = component.props.message; - if (!message?.persistent || !component.store.user) { +registerMessageAction("mark-as-unread-history", { + condition: ({message, owner, store, thread}) => { + if (!message?.persistent || !store.self) { return false; } - if (message.isHistory) { + if (thread?.eq(store.history)) { return true; } - if (component.env.messageCard && !message.isNeedaction) { + if (owner.env.messageCard && !message.needaction) { return true; } return false; }, - icon: "fa-eye-slash", - title: _t("Mark as Unread"), - onClick: async (component) => { - const message = component.props.message; - await component.messageService.setUndone(message); + icon: "fa fa-eye-slash", + name: _t("Mark as Unread"), + onSelected: async ({message, owner}) => { + await message.setUndone(); // Remove from search results if in search mode - const messageSearch = component.props.messageSearch; + const messageSearch = owner.props.messageSearch; if (messageSearch?.messages) { const index = messageSearch.messages.findIndex((m) => m.id === message.id); if (index !== -1) { diff --git a/mail_history_mark_unread/static/src/message_model_patch.esm.js b/mail_history_mark_unread/static/src/message_model_patch.esm.js new file mode 100644 index 0000000000..2f02971c7c --- /dev/null +++ b/mail_history_mark_unread/static/src/message_model_patch.esm.js @@ -0,0 +1,17 @@ +import {Message} from "@mail/core/common/message_model"; +import {patch} from "@web/core/utils/patch"; + +patch(Message.prototype, { + /** + * Mark this message as unread for the current user. + * This moves the message from History back to Inbox and is the inverse + * of the core setDone(). + */ + async setUndone() { + await this.store.env.services.orm.silent.call( + "mail.message", + "set_message_undone", + [[this.id]] + ); + }, +}); diff --git a/mail_history_mark_unread/static/src/message_service_patch.esm.js b/mail_history_mark_unread/static/src/message_service_patch.esm.js deleted file mode 100644 index 855b218a0f..0000000000 --- a/mail_history_mark_unread/static/src/message_service_patch.esm.js +++ /dev/null @@ -1,18 +0,0 @@ -/* @odoo-module */ - -import {MessageService} from "@mail/core/common/message_service"; -import {patch} from "@web/core/utils/patch"; - -patch(MessageService.prototype, { - /** - * Mark a message as unread for the current user. - * This moves the message from History back to Inbox. - * - * @param {Object} message - The message to mark as unread - */ - async setUndone(message) { - await this.orm.silent.call("mail.message", "set_message_undone", [ - [message.id], - ]); - }, -}); diff --git a/mail_history_mark_unread/tests/test_set_message_undone.py b/mail_history_mark_unread/tests/test_set_message_undone.py index 962827ec5f..8c1f062822 100644 --- a/mail_history_mark_unread/tests/test_set_message_undone.py +++ b/mail_history_mark_unread/tests/test_set_message_undone.py @@ -2,10 +2,10 @@ from unittest.mock import patch -from odoo.addons.base.tests.common import SavepointCaseWithUserDemo +from odoo.addons.base.tests.common import BaseCommon -class TestSetMessageUndone(SavepointCaseWithUserDemo): +class TestSetMessageUndone(BaseCommon): @classmethod def setUpClass(cls): super().setUpClass() @@ -33,17 +33,16 @@ def test_01_set_message_undone_marks_notification_unread_and_sends_bus(self): self.assertTrue(notification.is_read) with patch.object( - type(self.env["bus.bus"]), "_sendone", autospec=True - ) as mocked_sendone: + type(self.env.user), "_bus_send", autospec=True + ) as mocked_bus_send: message.set_message_undone() notification.invalidate_recordset(["is_read"]) self.assertFalse(notification.is_read) expected_counter = self.env.user.partner_id._get_needaction_count() - mocked_sendone.assert_called_once() - _self, target, notification_type, payload = mocked_sendone.call_args.args - self.assertEqual(target, self.env.user.partner_id) + mocked_bus_send.assert_called_once() + _self, notification_type, payload = mocked_bus_send.call_args.args self.assertEqual(notification_type, "mail.message/mark_as_unread") self.assertEqual(payload.get("message_ids"), [message.id]) self.assertEqual(payload.get("needaction_inbox_counter"), expected_counter) @@ -70,7 +69,7 @@ def test_02_set_message_undone_noop_when_no_read_notification(self): ) with patch.object( - type(self.env["bus.bus"]), "_sendone", autospec=True - ) as mocked_sendone: + type(self.env.user), "_bus_send", autospec=True + ) as mocked_bus_send: message.set_message_undone() - mocked_sendone.assert_not_called() + mocked_bus_send.assert_not_called()