-
-
Notifications
You must be signed in to change notification settings - Fork 588
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIG] mail_footer_notified_partner: Migration to 10.0
- Loading branch information
Showing
17 changed files
with
88 additions
and
143 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
File renamed without changes.
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 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2016 ACSONE SA/NV <https://acsone.eu> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
{ | ||
"name": "Notified partners in mail footer", | ||
"summary": """ | ||
This module adds the list of notified partners in the footer of | ||
notification e-mails sent by Odoo. | ||
""", | ||
"author": "ACSONE SA/NV,Odoo Community Association (OCA)", | ||
"installable": True, | ||
"website": "http://acsone.eu", | ||
"category": "Mail", | ||
"version": "10.0.1.0.0", | ||
"license": "AGPL-3", | ||
"depends": [ | ||
"mail", | ||
], | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,25 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2016 ACSONE SA/NV <https://acsone.eu> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from odoo import models, api | ||
from odoo.tools.translate import _ | ||
|
||
|
||
class MailNotification(models.Model): | ||
_inherit = 'res.partner' | ||
|
||
@api.model | ||
def _notify_send(self, body, subject, recipients, **mail_values): | ||
body += self.get_additional_footer(recipients) | ||
return super(MailNotification, self)._notify_send(body, subject, recipients, **mail_values) | ||
|
||
@api.model | ||
def get_additional_footer(self, recipients): | ||
recipients_name = [ | ||
recipient.name for recipient in recipients | ||
] | ||
additional_footer = u'<br /><small>%s%s.</small><br />' % \ | ||
(_('Also notified: '), | ||
', '.join(recipients_name)) | ||
return additional_footer |
File renamed without changes.
31 changes: 31 additions & 0 deletions
31
mail_footer_notified_partner/tests/test_mail_notification.py
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,31 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2016 ACSONE SA/NV <https://acsone.eu> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
import odoo.tests.common as common | ||
|
||
|
||
class TestMailNotification(common.TransactionCase): | ||
|
||
def setUp(self): | ||
super(TestMailNotification, self).setUp() | ||
|
||
self.partner_obj = self.env['res.partner'] | ||
|
||
#self.registry('ir.model').clear_caches() | ||
#self.registry('ir.model.data').clear_caches() | ||
|
||
def test_get_signature_footer(self): | ||
vals = { | ||
'name': 'p1@example.com', | ||
} | ||
partner1 = self.partner_obj.create(vals) | ||
|
||
body = 'this is the body' | ||
subject = 'this is the subject' | ||
recipients = partner1 | ||
emails, recipients_nbr = self.partner_obj._notify_send(body, subject, recipients) | ||
|
||
self.assertFalse( | ||
partner1.name in emails.body_html, | ||
'Partner name is not in the body of the mail') |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
45 changes: 0 additions & 45 deletions
45
mail_footer_notified_partners/tests/test_mail_notification.py
This file was deleted.
Oops, something went wrong.