Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions mail_history_mark_unread/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
.. 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
===========================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! 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/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
: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-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=19.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 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**

.. contents::
:local:

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/social/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 <https://github.com/OCA/social/issues/new?body=module:%20mail_history_mark_unread%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Credits
=======

Contributors
------------

- `ForgeFlow <https://www.forgeflow.com>`__:

- Andreu Orensanz <andreu.orensanz@forgeflow.com>

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 <https://github.com/OCA/social/tree/19.0/mail_history_mark_unread>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions mail_history_mark_unread/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from . import models
21 changes: 21 additions & 0 deletions mail_history_mark_unread/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# 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
and Search results""",
"version": "19.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_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",
],
},
}
23 changes: 23 additions & 0 deletions mail_history_mark_unread/i18n/es.po
Original file line number Diff line number Diff line change
@@ -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"
29 changes: 29 additions & 0 deletions mail_history_mark_unread/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# 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"
"PO-Revision-Date: 2025-12-18 08:06+0000\n"
"Last-Translator: mymage <stefano.consolaro@mymage.it>\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 "Segna da leggere"

#. module: mail_history_mark_unread
#: model:ir.model,name:mail_history_mark_unread.model_mail_message
msgid "Message"
msgstr "Messaggio"
26 changes: 26 additions & 0 deletions mail_history_mark_unread/i18n/mail_history_mark_unread.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# 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: \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/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 ""
3 changes: 3 additions & 0 deletions mail_history_mark_unread/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from . import mail_message
42 changes: 42 additions & 0 deletions mail_history_mark_unread/models/mail_message.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# 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 = partner_id._get_needaction_count()
self.env.user._bus_send(
"mail.message/mark_as_unread",
{
"message_ids": notifications.mail_message_id.ids,
"needaction_inbox_counter": counter,
},
)
3 changes: 3 additions & 0 deletions mail_history_mark_unread/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
2 changes: 2 additions & 0 deletions mail_history_mark_unread/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- [ForgeFlow](https://www.forgeflow.com):
- Andreu Orensanz \<<andreu.orensanz@forgeflow.com>\>
4 changes: 4 additions & 0 deletions mail_history_mark_unread/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading