diff --git a/.travis.yml b/.travis.yml index c3bcf99d..c8f9fedb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,6 +15,7 @@ addons: env: global: - VERSION="10.0" TESTS="0" LINT_CHECK="0" TRANSIFEX="0" + - PHANTOMJS_VERSION="2.1.2" WEBSITE_REPO="1" - TRANSIFEX_USER='transbot@odoo-community.org' - secure: "GRXFURohRzzBbzRovVHd+cObj1yBe9x9bddKqUo7jEGPo+MYHKfGo1M7disTDq6HPLgCwacbhWRsMavGORB3AEkoNewP7q31MKGGPiS8Com9wMmYUtDPs4ZiuUlakJjvfsmGlpwTWUe1Xv1YSZweXVGIESAn0SwhzKHrSKiTcSFAapTwdZXt0lKIsDcra/xOesJ8p9QjY4mzsgyeLrLUSq/Gpt/icAJeoktJ2c4Z6sMV4ozbaRgMFSMCxXKXQTNtLgFICfiJZ2PAw3BQTYo6iX0sdX3RekvaWVBiFr1iblrFjZleoZ9CnkOEKq0JL8EXHMeX7UBvkSJvQV4M3DPd5GdHA0docKDwgdJKUSP9oxBJ6ElYxG5/bbwOxWfY0x6mh/iJdSuNyrfaUqzaCfhQsckuEw6IgqcMGWLPoO5FSovzAtC+u0+GIqphyFsA25lku9B76eZB8KuqWEUJGQZswIOYUKc0i1A2S/ej6MjCYW0BrazhN5laP/6nu7RHmYs0sIrIaxeJJZG0AaVKWAXmTbcDplF07wzwQau4nk922pH5Bxmt2hB1BOzeOqCGnE3wTOAuacuDIfyJaIpTmNMALWeWk/EkMghDZXRRCEueZO5QR2LdcxJk86x5ANj6sxKVo+nkl+x93ZBsehqELn4rTHwjAaA+Ck3vWRkzfV8nJ3A=" matrix: diff --git a/website_mass_mailing_name/README.rst b/website_mass_mailing_name/README.rst new file mode 100644 index 00000000..7c573cb7 --- /dev/null +++ b/website_mass_mailing_name/README.rst @@ -0,0 +1,60 @@ +.. image:: https://img.shields.io/badge/licence-LGPL--3-blue.svg + :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3 + +=========================================== +Mass Mailing Subscription Snippet With Name +=========================================== + +This module extends the functionality of mass mailings to support asking for +the contact name directly in the subscription snippet. + +If you want to get partners created automatically and linked to the contacts, +you can additionally install the `mass_mailing_partner +`_ module. + +Usage +===== + +To use this module, you need to: + +#. Go to any website page. +#. Insert any structure block. +#. Insert the *Newsletter* block as you would usually, inside a structure one. +#. Choose the newsletter of your liking. +#. Press *Save*. + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/186/10.0 + +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. + +Credits +======= + +Contributors +------------ + +* Jairo Llopis + +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. diff --git a/website_mass_mailing_name/__init__.py b/website_mass_mailing_name/__init__.py new file mode 100644 index 00000000..16545e96 --- /dev/null +++ b/website_mass_mailing_name/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). + +from . import controllers diff --git a/website_mass_mailing_name/__manifest__.py b/website_mass_mailing_name/__manifest__.py new file mode 100644 index 00000000..019fc542 --- /dev/null +++ b/website_mass_mailing_name/__manifest__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +# Copyright 2016-2017 Jairo Llopis +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). +{ + "name": "Mass Mailing Subscription Snippet With Name", + "summary": "Ask for name when subscribing, and create and/or link partner", + "version": "10.0.1.0.0", + "category": "Website", + "website": "https://tecnativa.com/", + "author": "Tecnativa, Odoo Community Association (OCA)", + "license": "LGPL-3", + "application": False, + "installable": True, + "depends": [ + "website_mass_mailing", + ], + "demo": [ + "demo/assets.xml", + ], + "data": [ + "templates/assets.xml", + "templates/snippets.xml", + ], +} diff --git a/website_mass_mailing_name/controllers/__init__.py b/website_mass_mailing_name/controllers/__init__.py new file mode 100644 index 00000000..c02fd56e --- /dev/null +++ b/website_mass_mailing_name/controllers/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). + +from . import main diff --git a/website_mass_mailing_name/controllers/main.py b/website_mass_mailing_name/controllers/main.py new file mode 100644 index 00000000..cb50267c --- /dev/null +++ b/website_mass_mailing_name/controllers/main.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- +# Copyright 2016-2017 Jairo Llopis +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). + +from odoo.addons.website_mass_mailing.controllers import main +from odoo.http import request, route + + +class MassMailController(main.MassMailController): + @route() + def is_subscriber(self, *args, **kwargs): + """Get user name too.""" + result = super(MassMailController, self).is_subscriber(*args, **kwargs) + if request.website.user_id != request.env.user: + name = request.env.user.name + else: + name = request.session.get("mass_mailing_name", "") + return dict(result, name=name) + + @route() + def subscribe(self, list_id, email, **post): + """Store email with name in session.""" + result = super(MassMailController, self).subscribe( + list_id, email, **post) + name, email = request.env['mail.mass_mailing.contact'].sudo() \ + .get_name_email(email) + request.session["mass_mailing_name"] = name if name != email else "" + return result diff --git a/website_mass_mailing_name/demo/assets.xml b/website_mass_mailing_name/demo/assets.xml new file mode 100644 index 00000000..b569efc6 --- /dev/null +++ b/website_mass_mailing_name/demo/assets.xml @@ -0,0 +1,17 @@ + + + + + +