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

TA#66891 [16.0][MIG] mail_notification_no_action_button #146

Merged
merged 8 commits into from
Jul 2, 2024
Merged
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
3 changes: 3 additions & 0 deletions .docker_files/main/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
"category": "Other",
"summary": "Install all addons required for testing.",
"depends": [
"base",
"mail",
"mail_bot_no_pong",
"mail_notification_no_action_button",
],
"installable": True,
}
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ RUN gitoo install-all --conf_file /gitoo.yml --destination "${THIRD_PARTY_ADDONS
USER odoo

COPY mail_bot_no_pong /mnt/extra-addons/mail_bot_no_pong
COPY mail_notification_no_action_button /mnt/extra-addons/mail_notification_no_action_button

COPY .docker_files/main /mnt/extra-addons/main
COPY .docker_files/odoo.conf /etc/odoo
19 changes: 19 additions & 0 deletions mail_notification_no_action_button/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Mail Notification No Action Button
==================================
This module removes action buttons from internal notifications.

Before
------
.. image:: static/description/before.png

After
-----
.. image:: static/description/after.png

Contributors
------------
* Numigi (tm) and all its contributors (https://bit.ly/numigiens)

More information
----------------
* Meet us at https://bit.ly/numigi-com
4 changes: 4 additions & 0 deletions mail_notification_no_action_button/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright 2024-today Numigi and all its contributors (https://bit.ly/numigiens)
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from . import models

Check notice on line 4 in mail_notification_no_action_button/__init__.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

mail_notification_no_action_button/__init__.py#L4

'.models' imported but unused (F401)
17 changes: 17 additions & 0 deletions mail_notification_no_action_button/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2024-today Numigi and all its contributors (https://bit.ly/numigiens)
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

{

Check warning on line 4 in mail_notification_no_action_button/__manifest__.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

mail_notification_no_action_button/__manifest__.py#L4

Statement seems to have no effect
'name': 'Mail Notification No Action Button',
'version': '16.0.1.0.0',
'author': 'Numigi',
'maintainer': 'Numigi',
'license': 'LGPL-3',
'category': 'Discuss',
'summary': 'Remove action buttons from notifications',
'depends': [
'mail',
'crm'
],
'installable': True,
}
4 changes: 4 additions & 0 deletions mail_notification_no_action_button/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright 2024-today Numigi and all its contributors (https://bit.ly/numigiens)
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from . import mail_thread

Check notice on line 4 in mail_notification_no_action_button/models/__init__.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

mail_notification_no_action_button/models/__init__.py#L4

'.mail_thread' imported but unused (F401)
15 changes: 15 additions & 0 deletions mail_notification_no_action_button/models/mail_thread.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2024-today Numigi and all its contributors (https://bit.ly/numigiens)
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from odoo import models


class MailThread(models.AbstractModel):

_inherit = 'mail.thread'

def _notify_get_recipients_classify(self, *args, **kwargs):
res = super()._notify_get_recipients_classify(*args, **kwargs)
for data in res:
data['actions'] = []
return res
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions mail_notification_no_action_button/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright 2024-today Numigi and all its contributors (https://bit.ly/numigiens)
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from . import test_crm_lead
40 changes: 40 additions & 0 deletions mail_notification_no_action_button/tests/test_crm_lead.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Copyright 2024-today Numigi and all its contributors (https://bit.ly/numigiens)
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from ddt import ddt, data
from odoo.tests import SavepointCase


@ddt
class TestCRMLead(SavepointCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.user = cls.env["res.users"].create(
{
"name": "[email protected]",
"email": "[email protected]",
"login": "[email protected]",
}
)
cls.partner = cls.user.partner_id
cls.lead = cls.env["crm.lead"].create({"name": "M Lead"})
cls.subtype = cls.env.ref("mail.mt_comment")
cls.lead.message_subscribe([cls.partner.id], subtype_ids=[cls.subtype.id])

def send_notification_email(self):
message = self.lead.message_post(
body="Test",
mail_auto_delete=False,
send_after_commit=False,
force_send=True,
subtype_id=self.subtype.id
)
return self.env["mail.mail"].search(
[("mail_message_id", "=", message.id)], limit=1
)

@data("Won", "Lost", "Sales Team Settings")
def test_action_buttons_removed(self, button_label):
email = self.send_notification_email()
assert button_label not in email.body_html
Loading