Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[18.0][MIG] mail_notification_clean_status_error: Migration to 18.0 #1470

Closed
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
109 changes: 109 additions & 0 deletions mail_notification_clean_status_error/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
===================================================
Mail Notification - Clean up notifications in error
===================================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:9a004084c3440966fc0ecdfebe40e185c6fc5e59542d7b6a1b3985edbfa5c708
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
:target: https://odoo-community.org/page/development-status
:alt: Production/Stable
.. |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/18.0/mail_notification_clean_status_error
:alt: OCA/social
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/social-18-0/social-18-0-mail_notification_clean_status_error
: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=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

Delete email notifications in error.

The scheduled action *Notification: Delete Notifications older than 6
Month* provided by Odoo is responsible to delete notifications that have
been sent successfully.

However, it doesn't delete the notifications that could not be sent, and
their number could keep growing over time, impacting the performance of
some queries related to the chatter.

This module extends the scheduled action of Odoo to also delete such
notifications.

**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_notification_clean_status_error%0Aversion:%2018.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
=======

Authors
-------

* Camptocamp

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

- `Camptocamp <https://www.camptocamp.com>`__:

- Sébastien Alix <[email protected]>

- `Trobz <https://trobz.com>`__:

- Khoi (Kien Kim) <[email protected]>

Other credits
-------------

The migration of this module from 17.0 to 18.0 was financially supported
by:

- Camptocamp.

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.

.. |maintainer-sebalix| image:: https://github.com/sebalix.png?size=40px
:target: https://github.com/sebalix
:alt: sebalix

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-sebalix|

This module is part of the `OCA/social <https://github.com/OCA/social/tree/18.0/mail_notification_clean_status_error>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions mail_notification_clean_status_error/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
15 changes: 15 additions & 0 deletions mail_notification_clean_status_error/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2024 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
{
"name": "Mail Notification - Clean up notifications in error",
"summary": "Extend Odoo scheduled action to also delete notifications in error.",
"version": "18.0.1.0.0",
"category": "Mail",
"website": "https://github.com/OCA/social",
"author": "Camptocamp, Odoo Community Association (OCA)",
"license": "AGPL-3",
"installable": True,
"depends": ["mail"],
"development_status": "Production/Stable",
"maintainers": ["sebalix"],
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mail_notification_clean_status_error
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.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_notification_clean_status_error
#: model:ir.model.fields,field_description:mail_notification_clean_status_error.field_mail_notification__display_name
msgid "Display Name"
msgstr ""

#. module: mail_notification_clean_status_error
#: model:ir.model.fields,field_description:mail_notification_clean_status_error.field_mail_notification__id
msgid "ID"
msgstr ""

#. module: mail_notification_clean_status_error
#: model:ir.model.fields,field_description:mail_notification_clean_status_error.field_mail_notification____last_update
msgid "Last Modified on"
msgstr ""

#. module: mail_notification_clean_status_error
#: model:ir.model,name:mail_notification_clean_status_error.model_mail_notification
msgid "Message Notifications"
msgstr ""
1 change: 1 addition & 0 deletions mail_notification_clean_status_error/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import mail_notification
21 changes: 21 additions & 0 deletions mail_notification_clean_status_error/models/mail_notification.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2024 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)

from odoo import api, fields, models


class MailNotification(models.Model):
_inherit = "mail.notification"

@api.model
def _gc_notifications(self, max_age_days=180):
res = super()._gc_notifications(max_age_days=max_age_days)
# Extend GC to also delete notifications in error
read_date = fields.Datetime.subtract(fields.Datetime.now(), days=max_age_days)
domain = [
("is_read", "=", True),
("read_date", "<", read_date),
("notification_status", "in", ("bounce", "exception")),
]
self.search(domain).unlink()
return res
3 changes: 3 additions & 0 deletions mail_notification_clean_status_error/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
5 changes: 5 additions & 0 deletions mail_notification_clean_status_error/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- [Camptocamp](https://www.camptocamp.com):
- Sébastien Alix \<<[email protected]>\>

- [Trobz](https://trobz.com):
- Khoi (Kien Kim) \<<[email protected]>\>
3 changes: 3 additions & 0 deletions mail_notification_clean_status_error/readme/CREDITS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
The migration of this module from 17.0 to 18.0 was financially supported by:

- Camptocamp.
12 changes: 12 additions & 0 deletions mail_notification_clean_status_error/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Delete email notifications in error.

The scheduled action *Notification: Delete Notifications older than 6
Month* provided by Odoo is responsible to delete notifications that have
been sent successfully.

However, it doesn't delete the notifications that could not be sent, and
their number could keep growing over time, impacting the performance of
some queries related to the chatter.

This module extends the scheduled action of Odoo to also delete such
notifications.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading