[MIG] mass_mailing_newsletter_welcome_mail: Migration to 12.0

pull/452/head
ernesto 2019-10-24 15:21:18 -04:00
parent bb7f7d39a6
commit 950518ac26
6 changed files with 24 additions and 16 deletions

View File

@ -14,13 +14,13 @@ Welcome mail to new subscribers
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3 :alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github
:target: https://github.com/OCA/social/tree/11.0/mass_mailing_newsletter_welcome_mail :target: https://github.com/OCA/social/tree/12.0/mass_mailing_newsletter_welcome_mail
:alt: OCA/social :alt: OCA/social
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/social-11-0/social-11-0-mass_mailing_newsletter_welcome_mail :target: https://translation.odoo-community.org/projects/social-12-0/social-12-0-mass_mailing_newsletter_welcome_mail
:alt: Translate me on Weblate :alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/205/11.0 :target: https://runbot.odoo-community.org/runbot/205/12.0
:alt: Try me on Runbot :alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5| |badge1| |badge2| |badge3| |badge4| |badge5|
@ -39,7 +39,7 @@ Configuration
To configure this module, you need to: To configure this module, you need to:
#. Go to *Email Marketing > Contacts > Mailing Lists*. #. Go to *Email Marketing > Mailing Lists > Mailing Lists*.
#. Edit or create one. #. Edit or create one.
#. Set a *Welcome mail template* to enable this module's special behavior when #. Set a *Welcome mail template* to enable this module's special behavior when
somebody subscribes to this mailing list. You can use one shipped with somebody subscribes to this mailing list. You can use one shipped with
@ -82,7 +82,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/social/issues>`_. 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. 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 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:%20mass_mailing_newsletter_welcome_mail%0Aversion:%2011.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:%20mass_mailing_newsletter_welcome_mail%0Aversion:%2012.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. Do not contact contributors directly about support or help with technical issues.
@ -102,6 +102,7 @@ Contributors
* Cristina Martin R. * Cristina Martin R.
* Jairo Llopis * Jairo Llopis
* Ernesto Tejeda
Maintainers Maintainers
~~~~~~~~~~~ ~~~~~~~~~~~
@ -116,6 +117,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use. promote its widespread use.
This module is part of the `OCA/social <https://github.com/OCA/social/tree/11.0/mass_mailing_newsletter_welcome_mail>`_ project on GitHub. This module is part of the `OCA/social <https://github.com/OCA/social/tree/12.0/mass_mailing_newsletter_welcome_mail>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@ -7,7 +7,7 @@
'author': 'Tecnativa, ' 'author': 'Tecnativa, '
'Odoo Community Association (OCA)', 'Odoo Community Association (OCA)',
'category': 'Social', 'category': 'Social',
'version': '11.0.1.0.0', 'version': '12.0.1.0.0',
'website': 'https://github.com/OCA/social', 'website': 'https://github.com/OCA/social',
'depends': [ 'depends': [
'website_mass_mailing', 'website_mass_mailing',

View File

@ -16,11 +16,16 @@ class MassMailController(main.MassMailController):
if not template: if not template:
return result return result
# Welcome new subscribers # Welcome new subscribers
contact = request.env["mail.mass_mailing.contact"].sudo().search([ contact_obj = request.env["mail.mass_mailing.contact"].with_context(
('list_ids', 'in', list_.ids), default_list_ids=[list_id])
('email', '=', email), contact = contact_obj.sudo().search([
("opt_out", "=", False), ('email', '=', request.session['mass_mailing_email']),
('opt_out', '=', False), # Needed until odoo/odoo#39604 is fixed
('is_blacklisted', '=', False),
], limit=1) ], limit=1)
# Needed until odoo/odoo#39604 is fixed
if not contact:
return result
template.with_context(list_name=list_.name).send_mail( template.with_context(list_name=list_.name).send_mail(
contact.id, contact.id,
# Must send now to use context # Must send now to use context

View File

@ -1,6 +1,6 @@
To configure this module, you need to: To configure this module, you need to:
#. Go to *Email Marketing > Contacts > Mailing Lists*. #. Go to *Email Marketing > Mailing Lists > Mailing Lists*.
#. Edit or create one. #. Edit or create one.
#. Set a *Welcome mail template* to enable this module's special behavior when #. Set a *Welcome mail template* to enable this module's special behavior when
somebody subscribes to this mailing list. You can use one shipped with somebody subscribes to this mailing list. You can use one shipped with

View File

@ -3,3 +3,4 @@
* Cristina Martin R. * Cristina Martin R.
* Jairo Llopis * Jairo Llopis
* Ernesto Tejeda

View File

@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !! !! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !! !! 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/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/social/tree/11.0/mass_mailing_newsletter_welcome_mail"><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-11-0/social-11-0-mass_mailing_newsletter_welcome_mail"><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/11.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/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/social/tree/12.0/mass_mailing_newsletter_welcome_mail"><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-12-0/social-12-0-mass_mailing_newsletter_welcome_mail"><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/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>This module was written to extend the functionality of the website popup <p>This module was written to extend the functionality of the website popup
newsletter subscription form to support sending to new subscribers an newsletter subscription form to support sending to new subscribers an
automatic welcome email and allow you to customize it.</p> automatic welcome email and allow you to customize it.</p>
@ -390,7 +390,7 @@ automatic welcome email and allow you to customize it.</p>
<h1><a class="toc-backref" href="#id1">Configuration</a></h1> <h1><a class="toc-backref" href="#id1">Configuration</a></h1>
<p>To configure this module, you need to:</p> <p>To configure this module, you need to:</p>
<ol class="arabic simple"> <ol class="arabic simple">
<li>Go to <em>Email Marketing &gt; Contacts &gt; Mailing Lists</em>.</li> <li>Go to <em>Email Marketing &gt; Mailing Lists &gt; Mailing Lists</em>.</li>
<li>Edit or create one.</li> <li>Edit or create one.</li>
<li>Set a <em>Welcome mail template</em> to enable this modules special behavior when <li>Set a <em>Welcome mail template</em> to enable this modules special behavior when
somebody subscribes to this mailing list. You can use one shipped with somebody subscribes to this mailing list. You can use one shipped with
@ -433,7 +433,7 @@ emails will never be sent.</p>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/social/issues">GitHub Issues</a>. <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. 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 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:%20mass_mailing_newsletter_welcome_mail%0Aversion:%2011.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:%20mass_mailing_newsletter_welcome_mail%0Aversion:%2012.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> <p>Do not contact contributors directly about support or help with technical issues.</p>
</div> </div>
<div class="section" id="credits"> <div class="section" id="credits">
@ -450,6 +450,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul> <li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
<li>Cristina Martin R.</li> <li>Cristina Martin R.</li>
<li>Jairo Llopis</li> <li>Jairo Llopis</li>
<li>Ernesto Tejeda</li>
</ul> </ul>
</li> </li>
</ul> </ul>
@ -461,7 +462,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 <p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and mission is to support the collaborative development of Odoo features and
promote its widespread use.</p> promote its widespread use.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/social/tree/11.0/mass_mailing_newsletter_welcome_mail">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/12.0/mass_mailing_newsletter_welcome_mail">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> <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>
</div> </div>