-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TA#66891 [16.0][MIG] mail_notification_no_action_button (#146)
* [16.0][MIG] mail_notification_no_action_button --------- Co-authored-by: Majda EL MARIOULI <[email protected]>
- Loading branch information
1 parent
c82e07a
commit c88edda
Showing
10 changed files
with
103 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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). | ||
|
||
{ | ||
'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, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |