[MIG] mail_outbound_static: Migration to 15.0

This commit is contained in:
Maksym Yankin 2022-01-26 10:22:37 +02:00
parent 9640ff44ba
commit a4e70bc598
5 changed files with 32 additions and 30 deletions

View File

@ -14,13 +14,13 @@ Mail Outbound Static
: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/14.0/mail_outbound_static
:target: https://github.com/OCA/social/tree/15.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-14-0/social-14-0-mail_outbound_static
:target: https://translation.odoo-community.org/projects/social-15-0/social-15-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/14.0
:target: https://runbot.odoo-community.org/runbot/205/15.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
@ -68,7 +68,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <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/social/issues/new?body=module:%20mail_outbound_static%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/social/issues/new?body=module:%20mail_outbound_static%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues.
@ -105,6 +105,6 @@ 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 <https://github.com/OCA/social/tree/14.0/mail_outbound_static>`_ project on GitHub.
This module is part of the `OCA/social <https://github.com/OCA/social/tree/15.0/mail_outbound_static>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@ -1,10 +1,10 @@
# Copyright 2016-2017 LasLabs Inc.
# Copyright 2016-2022 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": "14.0.1.0.0",
"version": "15.0.1.0.0",
"category": "Discuss",
"website": "https://github.com/OCA/social",
"author": "brain-tec AG, LasLabs, Adhoc SA, Odoo Community Association (OCA)",

View File

@ -4,7 +4,7 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-09-03 12:53+0000\n"
"PO-Revision-Date: 2020-09-03 12:53+0000\n"

View File

@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/social/tree/14.0/mail_outbound_static"><img alt="OCA/social" src="https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/social-14-0/social-14-0-mail_outbound_static"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/205/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/social/tree/15.0/mail_outbound_static"><img alt="OCA/social" src="https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/social-15-0/social-15-0-mail_outbound_static"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/205/15.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>This module brings Odoo outbound emails in to strict compliance with RFC-2822
by allowing for a dynamically configured From header, with the senders e-mail
being appended into the proper Sender header instead. To accomplish this we:</p>
@ -417,7 +417,7 @@ server configured in the system.</li>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/social/issues">GitHub Issues</a>.
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
<a class="reference external" href="https://github.com/OCA/social/issues/new?body=module:%20mail_outbound_static%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/social/issues/new?body=module:%20mail_outbound_static%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
@ -448,7 +448,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<p>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.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/social/tree/14.0/mail_outbound_static">OCA/social</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/social/tree/15.0/mail_outbound_static">OCA/social</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>

View File

@ -16,28 +16,37 @@ _logger = logging.getLogger(__name__)
class TestIrMailServer(TransactionCase):
def setUp(self):
super(TestIrMailServer, self).setUp()
self.email_from = "derp@example.com"
self.email_from_another = "another@example.com"
self.Model = self.env["ir.mail_server"]
self.parameter_model = self.env["ir.config_parameter"]
self._delete_mail_servers()
self.Model.create(
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.email_from = "derp@example.com"
cls.email_from_another = "another@example.com"
cls.Model = cls.env["ir.mail_server"]
cls.parameter_model = cls.env["ir.config_parameter"]
cls._delete_mail_servers()
cls.Model.create(
{
"name": "localhost",
"smtp_host": "localhost",
"smtp_from": self.email_from,
"smtp_from": cls.email_from,
}
)
message_file = os.path.join(
os.path.dirname(os.path.realpath(__file__)), "test.msg"
)
with open(message_file, "r") as fh:
self.message = message_from_string(fh.read())
cls.message = message_from_string(fh.read())
@classmethod
def _delete_mail_servers(cls):
"""Delete all available mail servers"""
all_mail_servers = cls.Model.search([])
if all_mail_servers:
all_mail_servers.unlink()
def _init_mail_server_domain_whilelist_based(self):
self._delete_mail_servers()
self.assertFalse(self.Model.search([]))
self.mail_server_domainone = self.Model.create(
{
"name": "sandbox domainone",
@ -67,13 +76,6 @@ class TestIrMailServer(TransactionCase):
_logger.warn(reason)
self.skipTest(reason)
def _delete_mail_servers(self):
"""Delete all available mail servers"""
all_mail_servers = self.Model.search([])
if all_mail_servers:
all_mail_servers.unlink()
self.assertFalse(self.Model.search([]))
def _send_mail(self, message=None, mail_server_id=None, smtp_server=None):
if message is None:
message = self.message
@ -184,7 +186,7 @@ class TestIrMailServer(TransactionCase):
email_from = "Mitchell Admin <admin@%s>" % domain
self._delete_mail_servers()
self.assertFalse(self.Model.search([]))
# Find config values
config_smtp_from = tools.config.get("smtp_from")
config_smtp_domain_whitelist = tools.config.get("smtp_domain_whitelist")
@ -221,7 +223,7 @@ class TestIrMailServer(TransactionCase):
email_from = "Mitchell Admin <admin@%s>" % domain
self._delete_mail_servers()
self.assertFalse(self.Model.search([]))
self.message.replace_header("From", email_from)
message = self._send_mail()
self.assertEqual(message["From"], email_from)