From ca6bd04c1252b5dcf46541a1c7cdaa113137080b Mon Sep 17 00:00:00 2001 From: SimoRubi <32064796+SimoRubi@users.noreply.github.com> Date: Tue, 10 Oct 2017 11:37:56 +0200 Subject: [PATCH] [MIG] [10.0] mail_footer_notified_partner (#200) * [NEW][mail_footer_notified_partners] This module adds into the footer the partner's name notified by this email * [CHG] Use common.TransactionCase * OCA Transbot updated translations from Transifex OCA Transbot updated translations from Transifex OCA Transbot updated translations from Transifex * [FIX][mail_footer_notified_partners] Use @api.model instead of @api.one. * OCA Transbot updated translations from Transifex * [FIX] remove en.po that was erroneously created by transbot * Pass context * OCA Transbot updated translations from Transifex OCA Transbot updated translations from Transifex * [MIG] mail_footer_notified_partner: Migration to 10.0 --- mail_footer_notified_partner/README.rst | 52 +++++++++++++++++++ mail_footer_notified_partner/__init__.py | 4 ++ mail_footer_notified_partner/__manifest__.py | 19 +++++++ mail_footer_notified_partner/i18n/de.po | 30 +++++++++++ mail_footer_notified_partner/i18n/el_GR.po | 29 +++++++++++ mail_footer_notified_partner/i18n/es.po | 38 ++++++++++++++ mail_footer_notified_partner/i18n/fi.po | 29 +++++++++++ mail_footer_notified_partner/i18n/fr.po | 30 +++++++++++ mail_footer_notified_partner/i18n/it.po | 29 +++++++++++ mail_footer_notified_partner/i18n/sl.po | 30 +++++++++++ .../models/__init__.py | 4 ++ .../models/mail_followers.py | 26 ++++++++++ .../tests/__init__.py | 4 ++ .../tests/test_mail_notification.py | 28 ++++++++++ 14 files changed, 352 insertions(+) create mode 100644 mail_footer_notified_partner/README.rst create mode 100644 mail_footer_notified_partner/__init__.py create mode 100644 mail_footer_notified_partner/__manifest__.py create mode 100644 mail_footer_notified_partner/i18n/de.po create mode 100644 mail_footer_notified_partner/i18n/el_GR.po create mode 100644 mail_footer_notified_partner/i18n/es.po create mode 100644 mail_footer_notified_partner/i18n/fi.po create mode 100644 mail_footer_notified_partner/i18n/fr.po create mode 100644 mail_footer_notified_partner/i18n/it.po create mode 100644 mail_footer_notified_partner/i18n/sl.po create mode 100644 mail_footer_notified_partner/models/__init__.py create mode 100644 mail_footer_notified_partner/models/mail_followers.py create mode 100644 mail_footer_notified_partner/tests/__init__.py create mode 100644 mail_footer_notified_partner/tests/test_mail_notification.py diff --git a/mail_footer_notified_partner/README.rst b/mail_footer_notified_partner/README.rst new file mode 100644 index 00000000..1a0022f5 --- /dev/null +++ b/mail_footer_notified_partner/README.rst @@ -0,0 +1,52 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :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'. +(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 + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues +`_. In case of trouble, please +check there if your issue has already been reported. If you spotted it first, +help us smash it by providing detailed and welcomed feedback. + +Credits +======= + +Contributors +------------ + +* Jonathan Nemry +* Simone Rubino + +Do not contact contributors directly about support or help with technical issues. + +Maintainer +---------- + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +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. + +To contribute to this module, please visit https://odoo-community.org. \ No newline at end of file diff --git a/mail_footer_notified_partner/__init__.py b/mail_footer_notified_partner/__init__.py new file mode 100644 index 00000000..37c0ad40 --- /dev/null +++ b/mail_footer_notified_partner/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +# © 2016 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +from . import models diff --git a/mail_footer_notified_partner/__manifest__.py b/mail_footer_notified_partner/__manifest__.py new file mode 100644 index 00000000..ec17adeb --- /dev/null +++ b/mail_footer_notified_partner/__manifest__.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# © 2016 ACSONE SA/NV +# 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", + ], +} diff --git a/mail_footer_notified_partner/i18n/de.po b/mail_footer_notified_partner/i18n/de.po new file mode 100644 index 00000000..49dc4b6a --- /dev/null +++ b/mail_footer_notified_partner/i18n/de.po @@ -0,0 +1,30 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_footer_notified_partners +# +# Translators: +# Rudolf Schnapka , 2017 +msgid "" +msgstr "" +"Project-Id-Version: social (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-04-30 10:21+0000\n" +"PO-Revision-Date: 2017-03-18 17:25+0000\n" +"Last-Translator: Rudolf Schnapka \n" +"Language-Team: German (http://www.transifex.com/oca/OCA-social-8-0/language/de/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: de\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: mail_footer_notified_partners +#: code:addons/mail_footer_notified_partners/models/mail_followers.py:43 +#, python-format +msgid "Also notified: " +msgstr "Auch benachrichtigt:" + +#. module: mail_footer_notified_partners +#: model:ir.model,name:mail_footer_notified_partners.model_mail_notification +msgid "Notifications" +msgstr "Mitteilungen" diff --git a/mail_footer_notified_partner/i18n/el_GR.po b/mail_footer_notified_partner/i18n/el_GR.po new file mode 100644 index 00000000..ad41fb76 --- /dev/null +++ b/mail_footer_notified_partner/i18n/el_GR.po @@ -0,0 +1,29 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_footer_notified_partners +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: social (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-11-25 18:06+0000\n" +"PO-Revision-Date: 2016-10-11 11:53+0000\n" +"Last-Translator: Kostas Goutoudis \n" +"Language-Team: Greek (Greece) (http://www.transifex.com/oca/OCA-social-8-0/language/el_GR/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: el_GR\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: mail_footer_notified_partners +#: code:addons/mail_footer_notified_partners/models/mail_followers.py:43 +#, python-format +msgid "Also notified: " +msgstr "" + +#. module: mail_footer_notified_partners +#: model:ir.model,name:mail_footer_notified_partners.model_mail_notification +msgid "Notifications" +msgstr "Ειδοποιήσεις " diff --git a/mail_footer_notified_partner/i18n/es.po b/mail_footer_notified_partner/i18n/es.po new file mode 100644 index 00000000..65090579 --- /dev/null +++ b/mail_footer_notified_partner/i18n/es.po @@ -0,0 +1,38 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_footer_notified_partners +# +# Translators: +# Antonio Trueba, 2016 +# Armando Vulcano Junior , 2015 +# Carles Antoli , 2016 +# FIRST AUTHOR , 2014 +# Jarmo Kortetjärvi , 2016 +# Matjaž Mozetič , 2015 +# Paolo Valier, 2016 +# Rudolf Schnapka , 2016 +# SaFi J. , 2015 +msgid "" +msgstr "" +"Project-Id-Version: social (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-04-30 02:47+0000\n" +"PO-Revision-Date: 2016-04-24 16:44+0000\n" +"Last-Translator: Carles Antoli \n" +"Language-Team: Spanish (http://www.transifex.com/oca/OCA-social-8-0/language/es/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: es\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: mail_footer_notified_partners +#: code:addons/mail_footer_notified_partners/models/mail_followers.py:43 +#, python-format +msgid "Also notified: " +msgstr "También notificado:" + +#. module: mail_footer_notified_partners +#: model:ir.model,name:mail_footer_notified_partners.model_mail_notification +msgid "Notifications" +msgstr "Notificaciones" diff --git a/mail_footer_notified_partner/i18n/fi.po b/mail_footer_notified_partner/i18n/fi.po new file mode 100644 index 00000000..dfb8bd18 --- /dev/null +++ b/mail_footer_notified_partner/i18n/fi.po @@ -0,0 +1,29 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_footer_notified_partners +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: social (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-11-25 18:06+0000\n" +"PO-Revision-Date: 2016-09-29 13:23+0000\n" +"Last-Translator: Jarmo Kortetjärvi \n" +"Language-Team: Finnish (http://www.transifex.com/oca/OCA-social-8-0/language/fi/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: fi\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: mail_footer_notified_partners +#: code:addons/mail_footer_notified_partners/models/mail_followers.py:43 +#, python-format +msgid "Also notified: " +msgstr "" + +#. module: mail_footer_notified_partners +#: model:ir.model,name:mail_footer_notified_partners.model_mail_notification +msgid "Notifications" +msgstr "Ilmoitukset" diff --git a/mail_footer_notified_partner/i18n/fr.po b/mail_footer_notified_partner/i18n/fr.po new file mode 100644 index 00000000..e7a54a0d --- /dev/null +++ b/mail_footer_notified_partner/i18n/fr.po @@ -0,0 +1,30 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_footer_notified_partners +# +# Translators: +# Christophe CHAUVET , 2016 +msgid "" +msgstr "" +"Project-Id-Version: social (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-06-30 01:07+0000\n" +"PO-Revision-Date: 2016-06-17 14:15+0000\n" +"Last-Translator: Christophe CHAUVET \n" +"Language-Team: French (http://www.transifex.com/oca/OCA-social-8-0/language/fr/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: fr\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#. module: mail_footer_notified_partners +#: code:addons/mail_footer_notified_partners/models/mail_followers.py:43 +#, python-format +msgid "Also notified: " +msgstr "Également notifié:" + +#. module: mail_footer_notified_partners +#: model:ir.model,name:mail_footer_notified_partners.model_mail_notification +msgid "Notifications" +msgstr "Notifications" diff --git a/mail_footer_notified_partner/i18n/it.po b/mail_footer_notified_partner/i18n/it.po new file mode 100644 index 00000000..9e024dd1 --- /dev/null +++ b/mail_footer_notified_partner/i18n/it.po @@ -0,0 +1,29 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_footer_notified_partners +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: social (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-11-25 18:06+0000\n" +"PO-Revision-Date: 2016-02-26 16:19+0000\n" +"Last-Translator: <>\n" +"Language-Team: Italian (http://www.transifex.com/oca/OCA-social-8-0/language/it/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: it\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: mail_footer_notified_partners +#: code:addons/mail_footer_notified_partners/models/mail_followers.py:43 +#, python-format +msgid "Also notified: " +msgstr "" + +#. module: mail_footer_notified_partners +#: model:ir.model,name:mail_footer_notified_partners.model_mail_notification +msgid "Notifications" +msgstr "Notifiche" diff --git a/mail_footer_notified_partner/i18n/sl.po b/mail_footer_notified_partner/i18n/sl.po new file mode 100644 index 00000000..ded2c7a1 --- /dev/null +++ b/mail_footer_notified_partner/i18n/sl.po @@ -0,0 +1,30 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_footer_notified_partners +# +# Translators: +# Matjaž Mozetič , 2016 +msgid "" +msgstr "" +"Project-Id-Version: social (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-02-27 01:40+0000\n" +"PO-Revision-Date: 2016-02-27 16:56+0000\n" +"Last-Translator: Matjaž Mozetič \n" +"Language-Team: Slovenian (http://www.transifex.com/oca/OCA-social-8-0/language/sl/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: sl\n" +"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n" + +#. module: mail_footer_notified_partners +#: code:addons/mail_footer_notified_partners/models/mail_followers.py:43 +#, python-format +msgid "Also notified: " +msgstr "Obveščeni tudi:" + +#. module: mail_footer_notified_partners +#: model:ir.model,name:mail_footer_notified_partners.model_mail_notification +msgid "Notifications" +msgstr "Obvestila" diff --git a/mail_footer_notified_partner/models/__init__.py b/mail_footer_notified_partner/models/__init__.py new file mode 100644 index 00000000..de1bfecf --- /dev/null +++ b/mail_footer_notified_partner/models/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +# © 2016 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +from . import mail_followers diff --git a/mail_footer_notified_partner/models/mail_followers.py b/mail_footer_notified_partner/models/mail_followers.py new file mode 100644 index 00000000..2c1ddc3f --- /dev/null +++ b/mail_footer_notified_partner/models/mail_followers.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +# © 2016 ACSONE SA/NV +# 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'
%s%s.
' % \ + (_('Also notified: '), + ', '.join(recipients_name)) + return additional_footer diff --git a/mail_footer_notified_partner/tests/__init__.py b/mail_footer_notified_partner/tests/__init__.py new file mode 100644 index 00000000..4488e7cd --- /dev/null +++ b/mail_footer_notified_partner/tests/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +# © 2016 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +from . import test_mail_notification diff --git a/mail_footer_notified_partner/tests/test_mail_notification.py b/mail_footer_notified_partner/tests/test_mail_notification.py new file mode 100644 index 00000000..b0fc5127 --- /dev/null +++ b/mail_footer_notified_partner/tests/test_mail_notification.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- +# © 2016 ACSONE SA/NV +# 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'] + + 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.assertTrue( + partner1.name in emails.body_html, + 'Partner name is not in the body of the mail')