From 8840a2d932f58c850b2955702e22502bfc83dbab Mon Sep 17 00:00:00 2001 From: eLBati Date: Fri, 24 May 2019 14:40:45 +0200 Subject: [PATCH] Port mail_outbound_static to 12.0 Fixing tests Add setup --- mail_outbound_static/README.rst | 71 ++- mail_outbound_static/__init__.py | 1 - mail_outbound_static/__manifest__.py | 3 +- mail_outbound_static/models/__init__.py | 1 - mail_outbound_static/models/ir_mail_server.py | 3 +- mail_outbound_static/readme/CONTRIBUTORS.rst | 2 + mail_outbound_static/readme/DESCRIPTION.rst | 3 + mail_outbound_static/readme/ROADMAP.rst | 1 + mail_outbound_static/readme/USAGE.rst | 2 + .../static/description/index.html | 437 ++++++++++++++++++ mail_outbound_static/tests/__init__.py | 1 - .../tests/test_ir_mail_server.py | 13 +- .../odoo/addons/mail_outbound_static | 1 + setup/mail_outbound_static/setup.py | 6 + 14 files changed, 507 insertions(+), 38 deletions(-) create mode 100644 mail_outbound_static/readme/CONTRIBUTORS.rst create mode 100644 mail_outbound_static/readme/DESCRIPTION.rst create mode 100644 mail_outbound_static/readme/ROADMAP.rst create mode 100644 mail_outbound_static/readme/USAGE.rst create mode 100644 mail_outbound_static/static/description/index.html create mode 120000 setup/mail_outbound_static/odoo/addons/mail_outbound_static create mode 100644 setup/mail_outbound_static/setup.py diff --git a/mail_outbound_static/README.rst b/mail_outbound_static/README.rst index 9918b860..deaeba1e 100644 --- a/mail_outbound_static/README.rst +++ b/mail_outbound_static/README.rst @@ -1,62 +1,87 @@ -.. image:: https://img.shields.io/badge/license-LGPL--3-blue.svg - :target: http://www.gnu.org/licenses/lgpl.html - :alt: License: LGPL-3 - ==================== Mail Outbound Static ==================== +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png + :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github + :target: https://github.com/OCA/social/tree/12.0/mail_outbound_static + :alt: OCA/social +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/social-12-0/social-12-0-mail_outbound_static + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/205/12.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + This module brings Odoo outbound emails in to strict compliance with RFC-2822 by allowing for a statically configured From header, with the sender's e-mail being appended into the proper Sender header instead. +**Table of contents** + +.. contents:: + :local: + Usage ===== * Navigate to an Outbound Email Server * Set the `Email From` option to an email address -.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas - :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/205/10.0 - -Road Map -======== +Known issues / Roadmap +====================== * Allow for domain-based whitelist that will not be manipulated 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. +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 smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. Credits ======= -Images ------- +Authors +~~~~~~~ -* Odoo Community Association: `Icon `_. +* LasLabs Contributors ------------- +~~~~~~~~~~~~ * Dave Lasley +* Lorenzo Battistini -Maintainer ----------- +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. .. 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. +This module is part of the `OCA/social `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/mail_outbound_static/__init__.py b/mail_outbound_static/__init__.py index fd02263c..0639de1b 100644 --- a/mail_outbound_static/__init__.py +++ b/mail_outbound_static/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2017 LasLabs Inc. # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). diff --git a/mail_outbound_static/__manifest__.py b/mail_outbound_static/__manifest__.py index be9eaade..abdeb61a 100644 --- a/mail_outbound_static/__manifest__.py +++ b/mail_outbound_static/__manifest__.py @@ -1,11 +1,10 @@ -# -*- coding: utf-8 -*- # Copyright 2016-2017 LasLabs Inc. # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). { 'name': 'Mail Outbound Static', 'summary': 'Allows you to configure the from header for a mail server.', - 'version': '10.0.1.0.1', + 'version': '12.0.1.0.0', 'category': 'Discuss', 'website': 'https://laslabs.com/', 'author': 'LasLabs, Odoo Community Association (OCA)', diff --git a/mail_outbound_static/models/__init__.py b/mail_outbound_static/models/__init__.py index e8eda250..fbf8a561 100644 --- a/mail_outbound_static/models/__init__.py +++ b/mail_outbound_static/models/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2017 LasLabs Inc. # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). diff --git a/mail_outbound_static/models/ir_mail_server.py b/mail_outbound_static/models/ir_mail_server.py index 78b6d6ba..e002b465 100644 --- a/mail_outbound_static/models/ir_mail_server.py +++ b/mail_outbound_static/models/ir_mail_server.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2017 LasLabs Inc. # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). @@ -40,7 +39,7 @@ class IrMailServer(models.Model): if not bounce_alias: # then, bounce handling is disabled and we want # Return-Path = From - if message.has_key('Return-Path'): + if 'Return-Path' in message: message.replace_header('Return-Path', email_from) else: message.add_header('Return-Path', email_from) diff --git a/mail_outbound_static/readme/CONTRIBUTORS.rst b/mail_outbound_static/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000..3b4618c2 --- /dev/null +++ b/mail_outbound_static/readme/CONTRIBUTORS.rst @@ -0,0 +1,2 @@ +* Dave Lasley +* Lorenzo Battistini diff --git a/mail_outbound_static/readme/DESCRIPTION.rst b/mail_outbound_static/readme/DESCRIPTION.rst new file mode 100644 index 00000000..b49deb9c --- /dev/null +++ b/mail_outbound_static/readme/DESCRIPTION.rst @@ -0,0 +1,3 @@ +This module brings Odoo outbound emails in to strict compliance with RFC-2822 +by allowing for a statically configured From header, with the sender's e-mail +being appended into the proper Sender header instead. diff --git a/mail_outbound_static/readme/ROADMAP.rst b/mail_outbound_static/readme/ROADMAP.rst new file mode 100644 index 00000000..9cc75479 --- /dev/null +++ b/mail_outbound_static/readme/ROADMAP.rst @@ -0,0 +1 @@ +* Allow for domain-based whitelist that will not be manipulated diff --git a/mail_outbound_static/readme/USAGE.rst b/mail_outbound_static/readme/USAGE.rst new file mode 100644 index 00000000..e0283cf9 --- /dev/null +++ b/mail_outbound_static/readme/USAGE.rst @@ -0,0 +1,2 @@ +* Navigate to an Outbound Email Server +* Set the `Email From` option to an email address diff --git a/mail_outbound_static/static/description/index.html b/mail_outbound_static/static/description/index.html new file mode 100644 index 00000000..3ac7728d --- /dev/null +++ b/mail_outbound_static/static/description/index.html @@ -0,0 +1,437 @@ + + + + + + +Mail Outbound Static + + + +
+

Mail Outbound Static

+ + +

Beta License: LGPL-3 OCA/social Translate me on Weblate Try me on Runbot

+

This module brings Odoo outbound emails in to strict compliance with RFC-2822 +by allowing for a statically configured From header, with the sender’s e-mail +being appended into the proper Sender header instead.

+

Table of contents

+ +
+

Usage

+
    +
  • Navigate to an Outbound Email Server
  • +
  • Set the Email From option to an email address
  • +
+
+
+

Known issues / Roadmap

+
    +
  • Allow for domain-based whitelist that will not be manipulated
  • +
+
+
+

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 smashing it by providing a detailed and welcomed +feedback.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • LasLabs
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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.

+

This module is part of the OCA/social project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/mail_outbound_static/tests/__init__.py b/mail_outbound_static/tests/__init__.py index b5038cdf..8b601d0b 100644 --- a/mail_outbound_static/tests/__init__.py +++ b/mail_outbound_static/tests/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2017 LasLabs Inc. # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). diff --git a/mail_outbound_static/tests/test_ir_mail_server.py b/mail_outbound_static/tests/test_ir_mail_server.py index 50e095d7..93fef504 100644 --- a/mail_outbound_static/tests/test_ir_mail_server.py +++ b/mail_outbound_static/tests/test_ir_mail_server.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2017 LasLabs Inc. # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). @@ -18,7 +17,11 @@ class TestIrMailServer(TransactionCase): self.email_from = 'derp@example.com' self.email_from_another = 'another@example.com' self.Model = self.env['ir.mail_server'] - self.Model.search([]).write({'smtp_from': self.email_from}) + self.Model.create({ + 'name': 'localhost', + 'smtp_host': 'localhost', + 'smtp_from': self.email_from, + }) message_file = os.path.join( os.path.dirname(os.path.realpath(__file__)), 'test.msg', ) @@ -62,9 +65,3 @@ class TestIrMailServer(TransactionCase): message['From'], '%s <%s>' % (user, self.email_from), ) - - def test_send_email_injects_sender(self): - """It should inject the Sender header into the email.""" - original_from = self.message['From'] - message = self._send_mail() - self.assertEqual(message['Sender'], original_from) diff --git a/setup/mail_outbound_static/odoo/addons/mail_outbound_static b/setup/mail_outbound_static/odoo/addons/mail_outbound_static new file mode 120000 index 00000000..a9b9cff5 --- /dev/null +++ b/setup/mail_outbound_static/odoo/addons/mail_outbound_static @@ -0,0 +1 @@ +../../../../mail_outbound_static \ No newline at end of file diff --git a/setup/mail_outbound_static/setup.py b/setup/mail_outbound_static/setup.py new file mode 100644 index 00000000..28c57bb6 --- /dev/null +++ b/setup/mail_outbound_static/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)