From 950518ac267b301592a8968c82e32ebbb055a69e Mon Sep 17 00:00:00 2001 From: ernesto Date: Thu, 24 Oct 2019 15:21:18 -0400 Subject: [PATCH] [MIG] mass_mailing_newsletter_welcome_mail: Migration to 12.0 --- mass_mailing_newsletter_welcome_mail/README.rst | 13 +++++++------ .../__manifest__.py | 2 +- .../controllers/main.py | 13 +++++++++---- .../readme/CONFIGURE.rst | 2 +- .../readme/CONTRIBUTORS.rst | 1 + .../static/description/index.html | 9 +++++---- 6 files changed, 24 insertions(+), 16 deletions(-) diff --git a/mass_mailing_newsletter_welcome_mail/README.rst b/mass_mailing_newsletter_welcome_mail/README.rst index 8212ec7f1..04d3c5a6a 100644 --- a/mass_mailing_newsletter_welcome_mail/README.rst +++ b/mass_mailing_newsletter_welcome_mail/README.rst @@ -14,13 +14,13 @@ Welcome mail to new subscribers :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |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 .. |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 .. |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 |badge1| |badge2| |badge3| |badge4| |badge5| @@ -39,7 +39,7 @@ Configuration 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. #. 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 @@ -82,7 +82,7 @@ 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 `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -102,6 +102,7 @@ Contributors * Cristina Martin R. * Jairo Llopis + * Ernesto Tejeda 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 promote its widespread use. -This module is part of the `OCA/social `_ project on GitHub. +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/mass_mailing_newsletter_welcome_mail/__manifest__.py b/mass_mailing_newsletter_welcome_mail/__manifest__.py index e97550b6c..596c7127a 100644 --- a/mass_mailing_newsletter_welcome_mail/__manifest__.py +++ b/mass_mailing_newsletter_welcome_mail/__manifest__.py @@ -7,7 +7,7 @@ 'author': 'Tecnativa, ' 'Odoo Community Association (OCA)', 'category': 'Social', - 'version': '11.0.1.0.0', + 'version': '12.0.1.0.0', 'website': 'https://github.com/OCA/social', 'depends': [ 'website_mass_mailing', diff --git a/mass_mailing_newsletter_welcome_mail/controllers/main.py b/mass_mailing_newsletter_welcome_mail/controllers/main.py index 32e2119d4..733842013 100644 --- a/mass_mailing_newsletter_welcome_mail/controllers/main.py +++ b/mass_mailing_newsletter_welcome_mail/controllers/main.py @@ -16,11 +16,16 @@ class MassMailController(main.MassMailController): if not template: return result # Welcome new subscribers - contact = request.env["mail.mass_mailing.contact"].sudo().search([ - ('list_ids', 'in', list_.ids), - ('email', '=', email), - ("opt_out", "=", False), + contact_obj = request.env["mail.mass_mailing.contact"].with_context( + default_list_ids=[list_id]) + contact = contact_obj.sudo().search([ + ('email', '=', request.session['mass_mailing_email']), + ('opt_out', '=', False), # Needed until odoo/odoo#39604 is fixed + ('is_blacklisted', '=', False), ], limit=1) + # Needed until odoo/odoo#39604 is fixed + if not contact: + return result template.with_context(list_name=list_.name).send_mail( contact.id, # Must send now to use context diff --git a/mass_mailing_newsletter_welcome_mail/readme/CONFIGURE.rst b/mass_mailing_newsletter_welcome_mail/readme/CONFIGURE.rst index 58a41b6e0..5573b0860 100755 --- a/mass_mailing_newsletter_welcome_mail/readme/CONFIGURE.rst +++ b/mass_mailing_newsletter_welcome_mail/readme/CONFIGURE.rst @@ -1,6 +1,6 @@ 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. #. 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 diff --git a/mass_mailing_newsletter_welcome_mail/readme/CONTRIBUTORS.rst b/mass_mailing_newsletter_welcome_mail/readme/CONTRIBUTORS.rst index 9bf686723..d589b7bb0 100755 --- a/mass_mailing_newsletter_welcome_mail/readme/CONTRIBUTORS.rst +++ b/mass_mailing_newsletter_welcome_mail/readme/CONTRIBUTORS.rst @@ -3,3 +3,4 @@ * Cristina Martin R. * Jairo Llopis + * Ernesto Tejeda diff --git a/mass_mailing_newsletter_welcome_mail/static/description/index.html b/mass_mailing_newsletter_welcome_mail/static/description/index.html index 7756779fc..b4d8e83b0 100644 --- a/mass_mailing_newsletter_welcome_mail/static/description/index.html +++ b/mass_mailing_newsletter_welcome_mail/static/description/index.html @@ -367,7 +367,7 @@ ul.auto-toc { !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

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

+

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

This module was written to extend the functionality of the website popup newsletter subscription form to support sending to new subscribers an automatic welcome email and allow you to customize it.

@@ -390,7 +390,7 @@ automatic welcome email and allow you to customize it.

Configuration

To configure this module, you need to:

    -
  1. Go to Email Marketing > Contacts > Mailing Lists.
  2. +
  3. Go to Email Marketing > Mailing Lists > Mailing Lists.
  4. Edit or create one.
  5. 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 @@ -433,7 +433,7 @@ emails will never be sent.

    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.

    +feedback.

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

    @@ -450,6 +450,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
  6. Tecnativa:
    • Cristina Martin R.
    • Jairo Llopis
    • +
    • Ernesto Tejeda
  7. @@ -461,7 +462,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome

    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.

    +

    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.