diff --git a/event_registration_mass_mailing/README.rst b/event_registration_mass_mailing/README.rst new file mode 100644 index 000000000..33ab07920 --- /dev/null +++ b/event_registration_mass_mailing/README.rst @@ -0,0 +1,54 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +======================== +Mass mailing from events +======================== + +This module adds actions to send mass mailings and allows to add to mailing +lists from event registrations tree view. + +Usage +===== + +* Add 'More > Mass mailing to partners' button in the partner views: with this + button, you can send an email to the selected registrations. + +* Add 'More > Add to mailing list' button in the partner views: with this + button, you can add the selected registrations to a mailing list. + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/199/8.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 +`here `_. + + +Credits +======= + +Contributors +------------ +* Javier Iniesta + +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 http://odoo-community.org. diff --git a/event_registration_mass_mailing/__init__.py b/event_registration_mass_mailing/__init__.py new file mode 100644 index 000000000..45216ff29 --- /dev/null +++ b/event_registration_mass_mailing/__init__.py @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# License AGPL-3: Antiun Ingenieria S.L. - Javier Iniesta +# See README.rst file on addon root folder for more details + +from . import models +from . import wizard diff --git a/event_registration_mass_mailing/__openerp__.py b/event_registration_mass_mailing/__openerp__.py new file mode 100644 index 000000000..2bd8ab060 --- /dev/null +++ b/event_registration_mass_mailing/__openerp__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# License AGPL-3: Antiun Ingenieria S.L. - Javier Iniesta +# See README.rst file on addon root folder for more details + +{ + 'name': "Mass mailing from events", + 'category': 'Marketing', + 'version': '8.0.1.0.0', + 'depends': [ + 'event', + 'mass_mailing' + ], + 'data': [ + 'views/event_registration.xml', + 'wizard/event_registration_mail_list_wizard.xml', + ], + 'author': 'Antiun Ingeniería S.L.,Odoo Community Association (OCA)', + 'website': 'http://www.antiun.com', + 'license': 'AGPL-3', + 'installable': True, + 'auto_install': True, +} diff --git a/event_registration_mass_mailing/i18n/es.po b/event_registration_mass_mailing/i18n/es.po new file mode 100644 index 000000000..b47bdcd13 --- /dev/null +++ b/event_registration_mass_mailing/i18n/es.po @@ -0,0 +1,123 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * event_registration_mass_mailing +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-11-10 16:37+0000\n" +"PO-Revision-Date: 2015-11-10 16:37+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: event_registration_mass_mailing +#: model:ir.actions.act_window,name:event_registration_mass_mailing.action_event_registration_mail_list +msgid "Add to mailing list" +msgstr "Añadir a lista de correos" + +#. module: event_registration_mass_mailing +#: view:event.registration:event_registration_mass_mailing.view_registration_search +msgid "Available for mass mailing" +msgstr "Disponible para envío masivo de correo" + +#. module: event_registration_mass_mailing +#: view:event.registration.mail.list.wizard:event_registration_mass_mailing.event_registration_mail_list_wizard_form +msgid "Cancel" +msgstr "Cancelar" + +#. module: event_registration_mass_mailing +#: view:event.registration.mail.list.wizard:event_registration_mass_mailing.event_registration_mail_list_wizard_form +#: model:ir.model,name:event_registration_mass_mailing.model_event_registration_mail_list_wizard +msgid "Create contact mailing list" +msgstr "Crear contactos de lista de correo" + +#. module: event_registration_mass_mailing +#: view:event.registration.mail.list.wizard:event_registration_mass_mailing.event_registration_mail_list_wizard_form +msgid "Create contacts" +msgstr "Crear contactos" + +#. module: event_registration_mass_mailing +#: field:event.registration.mail.list.wizard,create_uid:0 +msgid "Created by" +msgstr "Creado por" + +#. module: event_registration_mass_mailing +#: field:event.registration.mail.list.wizard,create_date:0 +msgid "Created on" +msgstr "Creado en" + +#. module: event_registration_mass_mailing +#: model:ir.model,name:event_registration_mass_mailing.model_event_registration +msgid "Event Registration" +msgstr "Registro" + +#. module: event_registration_mass_mailing +#: code:addons/event_registration_mass_mailing/models/mass_mailing.py:15 +#, python-format +msgid "Event Registrations" +msgstr "Registros a eventos" + +#. module: event_registration_mass_mailing +#: field:event.registration.mail.list.wizard,event_registrations:0 +msgid "Event registrations" +msgstr "Registros" + +#. module: event_registration_mass_mailing +#: field:event.registration.mail.list.wizard,id:0 +msgid "ID" +msgstr "ID" + +#. module: event_registration_mass_mailing +#: help:event.registration,opt_out:0 +msgid "If opt-out is checked, this contact has refused to receive emails for mass mailing and marketing campaign." +msgstr "Si 'No acepta mensajes' está marcado, este contacto ha rehusado recibir correos electrónicos de envíos masivos y campañas de marketing." + +#. module: event_registration_mass_mailing +#: field:event.registration.mail.list.wizard,write_uid:0 +msgid "Last Updated by" +msgstr "Última actualización por" + +#. module: event_registration_mass_mailing +#: field:event.registration.mail.list.wizard,write_date:0 +msgid "Last Updated on" +msgstr "Última actualización en" + +#. module: event_registration_mass_mailing +#: field:event.registration.mail.list.wizard,mail_list:0 +msgid "Mailing list" +msgstr "Lista de correo" + +#. module: event_registration_mass_mailing +#: model:ir.model,name:event_registration_mass_mailing.model_mail_mass_mailing +msgid "Mass Mailing" +msgstr "Envío masivo" + +#. module: event_registration_mass_mailing +#: model:ir.actions.act_window,name:event_registration_mass_mailing.action_event_registration_mass_mail +msgid "Mass mailing to partners" +msgstr "Envío masivo a empresas" + +#. module: event_registration_mass_mailing +#: view:event.registration:event_registration_mass_mailing.view_registration_search +msgid "New" +msgstr "Nuevo" + +#. module: event_registration_mass_mailing +#: field:event.registration,opt_out:0 +msgid "Opt-Out" +msgstr "No acepta recibir emails" + +#. module: event_registration_mass_mailing +#: view:event.registration:event_registration_mass_mailing.view_registration_search +msgid "Registrations that did not ask not to be included in mass mailing campaigns" +msgstr "Registros que pidieron no ser incluidos en campañas de envío masivo de correos" + +#. module: event_registration_mass_mailing +#: view:event.registration.mail.list.wizard:event_registration_mass_mailing.event_registration_mail_list_wizard_form +msgid "or" +msgstr "o" diff --git a/event_registration_mass_mailing/i18n/event_registration_mass_mailing.pot b/event_registration_mass_mailing/i18n/event_registration_mass_mailing.pot new file mode 100644 index 000000000..4f81f65aa --- /dev/null +++ b/event_registration_mass_mailing/i18n/event_registration_mass_mailing.pot @@ -0,0 +1,123 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * event_registration_mass_mailing +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-11-10 16:37+0000\n" +"PO-Revision-Date: 2015-11-10 16:37+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: event_registration_mass_mailing +#: model:ir.actions.act_window,name:event_registration_mass_mailing.action_event_registration_mail_list +msgid "Add to mailing list" +msgstr "" + +#. module: event_registration_mass_mailing +#: view:event.registration:event_registration_mass_mailing.view_registration_search +msgid "Available for mass mailing" +msgstr "" + +#. module: event_registration_mass_mailing +#: view:event.registration.mail.list.wizard:event_registration_mass_mailing.event_registration_mail_list_wizard_form +msgid "Cancel" +msgstr "" + +#. module: event_registration_mass_mailing +#: view:event.registration.mail.list.wizard:event_registration_mass_mailing.event_registration_mail_list_wizard_form +#: model:ir.model,name:event_registration_mass_mailing.model_event_registration_mail_list_wizard +msgid "Create contact mailing list" +msgstr "" + +#. module: event_registration_mass_mailing +#: view:event.registration.mail.list.wizard:event_registration_mass_mailing.event_registration_mail_list_wizard_form +msgid "Create contacts" +msgstr "" + +#. module: event_registration_mass_mailing +#: field:event.registration.mail.list.wizard,create_uid:0 +msgid "Created by" +msgstr "" + +#. module: event_registration_mass_mailing +#: field:event.registration.mail.list.wizard,create_date:0 +msgid "Created on" +msgstr "" + +#. module: event_registration_mass_mailing +#: model:ir.model,name:event_registration_mass_mailing.model_event_registration +msgid "Event Registration" +msgstr "" + +#. module: event_registration_mass_mailing +#: code:addons/event_registration_mass_mailing/models/mass_mailing.py:15 +#, python-format +msgid "Event Registrations" +msgstr "" + +#. module: event_registration_mass_mailing +#: field:event.registration.mail.list.wizard,event_registrations:0 +msgid "Event registrations" +msgstr "" + +#. module: event_registration_mass_mailing +#: field:event.registration.mail.list.wizard,id:0 +msgid "ID" +msgstr "" + +#. module: event_registration_mass_mailing +#: help:event.registration,opt_out:0 +msgid "If opt-out is checked, this contact has refused to receive emails for mass mailing and marketing campaign." +msgstr "" + +#. module: event_registration_mass_mailing +#: field:event.registration.mail.list.wizard,write_uid:0 +msgid "Last Updated by" +msgstr "" + +#. module: event_registration_mass_mailing +#: field:event.registration.mail.list.wizard,write_date:0 +msgid "Last Updated on" +msgstr "" + +#. module: event_registration_mass_mailing +#: field:event.registration.mail.list.wizard,mail_list:0 +msgid "Mailing list" +msgstr "" + +#. module: event_registration_mass_mailing +#: model:ir.model,name:event_registration_mass_mailing.model_mail_mass_mailing +msgid "Mass Mailing" +msgstr "" + +#. module: event_registration_mass_mailing +#: model:ir.actions.act_window,name:event_registration_mass_mailing.action_event_registration_mass_mail +msgid "Mass mailing to partners" +msgstr "" + +#. module: event_registration_mass_mailing +#: view:event.registration:event_registration_mass_mailing.view_registration_search +msgid "New" +msgstr "" + +#. module: event_registration_mass_mailing +#: field:event.registration,opt_out:0 +msgid "Opt-Out" +msgstr "" + +#. module: event_registration_mass_mailing +#: view:event.registration:event_registration_mass_mailing.view_registration_search +msgid "Registrations that did not ask not to be included in mass mailing campaigns" +msgstr "" + +#. module: event_registration_mass_mailing +#: view:event.registration.mail.list.wizard:event_registration_mass_mailing.event_registration_mail_list_wizard_form +msgid "or" +msgstr "" diff --git a/event_registration_mass_mailing/models/__init__.py b/event_registration_mass_mailing/models/__init__.py new file mode 100644 index 000000000..b6ffb4c9e --- /dev/null +++ b/event_registration_mass_mailing/models/__init__.py @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# License AGPL-3: Antiun Ingenieria S.L. - Javier Iniesta +# See README.rst file on addon root folder for more details + +from . import event_registration +from . import mass_mailing diff --git a/event_registration_mass_mailing/models/event_registration.py b/event_registration_mass_mailing/models/event_registration.py new file mode 100644 index 000000000..94846d0e9 --- /dev/null +++ b/event_registration_mass_mailing/models/event_registration.py @@ -0,0 +1,14 @@ +# -*- coding: utf-8 -*- +# License AGPL-3: Antiun Ingenieria S.L. - Javier Iniesta +# See README.rst file on addon root folder for more details + +from openerp import models, fields + + +class EventRegistration(models.Model): + _inherit = 'event.registration' + + opt_out = fields.Boolean( + string="Opt-Out", default=False, + help="If opt-out is checked, this contact has refused to receive " + "emails for mass mailing and marketing campaign.") diff --git a/event_registration_mass_mailing/models/mass_mailing.py b/event_registration_mass_mailing/models/mass_mailing.py new file mode 100644 index 000000000..f4b3b9489 --- /dev/null +++ b/event_registration_mass_mailing/models/mass_mailing.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# License AGPL-3: Antiun Ingenieria S.L. - Javier Iniesta +# See README.rst file on addon root folder for more details + +from openerp import models, api +from openerp.tools.translate import _ + + +class MassMailing(models.Model): + _inherit = 'mail.mass_mailing' + + @api.model + def _get_mailing_model(self): + res = super(MassMailing, self)._get_mailing_model() + res.append(('event.registration', _('Event Registrations'))) + return res diff --git a/event_registration_mass_mailing/tests/__init__.py b/event_registration_mass_mailing/tests/__init__.py new file mode 100644 index 000000000..d3c154f35 --- /dev/null +++ b/event_registration_mass_mailing/tests/__init__.py @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- +# License AGPL-3: Antiun Ingenieria S.L. - Javier Iniesta +# See README.rst file on addon root folder for more details + +from . import test_event_registration_mail_list_wizard diff --git a/event_registration_mass_mailing/tests/test_event_registration_mail_list_wizard.py b/event_registration_mass_mailing/tests/test_event_registration_mail_list_wizard.py new file mode 100644 index 000000000..d91d5f264 --- /dev/null +++ b/event_registration_mass_mailing/tests/test_event_registration_mail_list_wizard.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +# License AGPL-3: Antiun Ingenieria S.L. - Javier Iniesta +# See README.rst file on addon root folder for more details + +from openerp.tests.common import TransactionCase + + +class TestEventRegistrationMailListWizard(TransactionCase): + + def setUp(self): + super(TestEventRegistrationMailListWizard, self).setUp() + self.mail_list = self.env['mail.mass_mailing.list'].create({ + 'name': 'Test 01'}) + self.contact = self.env['mail.mass_mailing.contact'].create({ + 'name': 'Test Contact 01', 'email': 'email01@test.com', + 'list_id': self.mail_list.id}) + self.event = self.env.ref('event.event_0') + self.registration_01 = self.env['event.registration'].create({ + 'name': 'Test Registration 01', 'email': 'email01@test.com', + 'event_id': self.event.id}) + self.registration_02 = self.env['event.registration'].create({ + 'name': 'Test Registration 02', 'email': 'email02@test.com', + 'event_id': self.event.id}) + + def test_add_to_mail_list(self): + wizard = self.env['event.registration.mail.list.wizard'].create({ + 'mail_list': self.mail_list.id}) + wizard.with_context( + {'active_ids': [self.registration_01.id, + self.registration_02.id]}).add_to_mail_list() + + self.assertEqual(self.mail_list.contact_nbr, 2) diff --git a/event_registration_mass_mailing/views/event_registration.xml b/event_registration_mass_mailing/views/event_registration.xml new file mode 100644 index 000000000..e04d1342b --- /dev/null +++ b/event_registration_mass_mailing/views/event_registration.xml @@ -0,0 +1,74 @@ + + + + + + Event Registration Mass Mail + + + ${object.partner_id.id} + ${object.email} + + + + + + + + Marketing - Registrations Search + event.registration + + + + + + + + + + + Marketing - Registrations Tree + event.registration + + + + + + + + + + Marketing - Registrations Form + event.registration + + + + + + + + diff --git a/event_registration_mass_mailing/wizard/__init__.py b/event_registration_mass_mailing/wizard/__init__.py new file mode 100644 index 000000000..36b180a2f --- /dev/null +++ b/event_registration_mass_mailing/wizard/__init__.py @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- +# License AGPL-3: Antiun Ingenieria S.L. - Javier Iniesta +# See README.rst file on addon root folder for more details + +from . import event_registration_mail_list_wizard diff --git a/event_registration_mass_mailing/wizard/event_registration_mail_list_wizard.py b/event_registration_mass_mailing/wizard/event_registration_mail_list_wizard.py new file mode 100644 index 000000000..36021ca25 --- /dev/null +++ b/event_registration_mass_mailing/wizard/event_registration_mail_list_wizard.py @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- +# License AGPL-3: Antiun Ingenieria S.L. - Javier Iniesta +# See README.rst file on addon root folder for more details + +from openerp import models, api, fields + + +class EventRegistrationMailListWizard(models.TransientModel): + _name = "event.registration.mail.list.wizard" + _description = "Create contact mailing list" + + mail_list = fields.Many2one(comodel_name="mail.mass_mailing.list", + string="Mailing list") + event_registrations = fields.Many2many(comodel_name="event.registration", + relation="mail_list_wizard_event" + "_registration") + + @api.multi + def add_to_mail_list(self): + contact_obj = self.env['mail.mass_mailing.contact'] + registration_obj = self.env['event.registration'] + for registration_id in self.env.context.get('active_ids', []): + registration = registration_obj.browse(registration_id) + criteria = [('email', '=', registration.email), + ('list_id', '=', self.mail_list.id)] + contact_test = contact_obj.search(criteria) + if contact_test: + continue + contact_vals = { + 'email': registration.email, + 'name': registration.name, + 'list_id': self.mail_list.id + } + contact_obj.create(contact_vals) diff --git a/event_registration_mass_mailing/wizard/event_registration_mail_list_wizard.xml b/event_registration_mass_mailing/wizard/event_registration_mail_list_wizard.xml new file mode 100644 index 000000000..41b435736 --- /dev/null +++ b/event_registration_mass_mailing/wizard/event_registration_mail_list_wizard.xml @@ -0,0 +1,23 @@ + + + + + + event.registration.mail.list.form + event.registration.mail.list.wizard + +
+ + + + +
+
+
+ +
+