Skip to content

Commit

Permalink
[MIG] mail_footer_notified_partner: Migration to 10.0
Browse files Browse the repository at this point in the history
  • Loading branch information
SimoRubi committed Sep 22, 2017
1 parent 60f53b2 commit fe19d4c
Show file tree
Hide file tree
Showing 17 changed files with 88 additions and 143 deletions.
Original file line number Diff line number Diff line change
@@ -1,38 +1,29 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:alt: License
:target: https://www.gnu.org/licenses/agpl
:alt: License: AGPL-3

================================
Notified partners in mail footer
================================

This module adds the list of notified partners in the footer of notification e-mails sent by Odoo.
The partner will be added if its 'notify_email' is not 'none' or if the partner is linked to a user.
(In order to be consitency with Odoo)
The partner will be added if its 'notify_email' is not 'none'.
(In order to be consistent with Odoo)

Usage
=====

.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:target: https://runbot.odoo-community.org/runbot/205/10.0
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/205/8.0

Known issues / Roadmap
======================

* Add a second boolean into the partner form in order to manage the added
partners with an other field than 'notify_email'

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

Bugs are tracked on `GitHub Issues
<https://github.com/OCA/205/issues>`_. In case of trouble, please
<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 smashing it by providing a detailed and welcomed `feedback
<https://github.com/OCA/
205/issues/new?body=module:%20
mail_footer_notified_partners%0Aversion:%20
8.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
help us smash it by providing detailed and welcomed feedback.

Credits
=======
Expand All @@ -41,6 +32,9 @@ Contributors
------------

* Jonathan Nemry <jonathan.nemry@acsone.eu>
* Simone Rubino <simone.rubino@agilebg.com>

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

Maintainer
----------
Expand All @@ -51,6 +45,8 @@ Maintainer

This module is maintained by the OCA.

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.
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.

To contribute to this module, please visit https://odoo-community.org.
File renamed without changes.
19 changes: 19 additions & 0 deletions mail_footer_notified_partner/__manifest__.py
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.
25 changes: 25 additions & 0 deletions mail_footer_notified_partner/models/mail_followers.py
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
31 changes: 31 additions & 0 deletions mail_footer_notified_partner/tests/test_mail_notification.py
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')
18 changes: 0 additions & 18 deletions mail_footer_notified_partners/__openerp__.py

This file was deleted.

63 changes: 0 additions & 63 deletions mail_footer_notified_partners/models/mail_followers.py

This file was deleted.

45 changes: 0 additions & 45 deletions mail_footer_notified_partners/tests/test_mail_notification.py

This file was deleted.

0 comments on commit fe19d4c

Please sign in to comment.