Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MIG] event_registration_mass_mailing: Migration to 10.0 #80

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
55 changes: 55 additions & 0 deletions event_registration_mass_mailing/README.rst
@@ -0,0 +1,55 @@
.. 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 'Action > Mass mailing to partners' button in the registrations view:
with this button, you can send an email to the selected registrations.

* Add 'Action > Add to mailing list' button in the registrations view: 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/10.0

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/event/issues>`_. In
case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smash it by providing detailed and welcomed
feedback.

Credits
=======

Contributors
------------
* Javier Iniesta <javieria@antiun.com>
* Vicent Cubells <vicent.cubells@tecnativa.com>
* David Vidal <david.vidal@tecnativa.com>

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.
6 changes: 6 additions & 0 deletions event_registration_mass_mailing/__init__.py
@@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright 2016 Antiun Ingenieria S.L. - Javier Iniesta
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import models
from . import wizard
24 changes: 24 additions & 0 deletions event_registration_mass_mailing/__manifest__.py
@@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
# Copyright 2016 Antiun Ingenieria S.L. - Javier Iniesta
# Copyright 2017 Tecnativa - Vicent Cubells
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
'name': "Mass mailing from events",
'category': 'Marketing',
'version': '10.0.1.0.0',
'depends': [
'event',
'mass_mailing'
],
'data': [
'views/event_registration.xml',
'wizard/event_registration_mail_list_wizard.xml',
],
'author': 'Tecnativa, '
'Odoo Community Association (OCA)',
'website': 'http://www.antiun.com',
'license': 'AGPL-3',
'installable': True,
'auto_install': True,
}
118 changes: 118 additions & 0 deletions event_registration_mass_mailing/i18n/es.po
@@ -0,0 +1,118 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * event_registration_mass_mailing
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.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"
5 changes: 5 additions & 0 deletions event_registration_mass_mailing/models/__init__.py
@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import event_registration
from . import mass_mailing
14 changes: 14 additions & 0 deletions event_registration_mass_mailing/models/event_registration.py
@@ -0,0 +1,14 @@
# -*- coding: utf-8 -*-
# Copyright 2016 Antiun Ingenieria S.L. - Javier Iniesta
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import fields, models


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.")
15 changes: 15 additions & 0 deletions event_registration_mass_mailing/models/mass_mailing.py
@@ -0,0 +1,15 @@
# -*- coding: utf-8 -*-
# Copyright 2016 Antiun Ingenieria S.L. - Javier Iniesta
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import _, api, models


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
4 changes: 4 additions & 0 deletions event_registration_mass_mailing/tests/__init__.py
@@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import test_event_registration_mail_list_wizard
@@ -0,0 +1,38 @@
# -*- coding: utf-8 -*-
# Copyright 2016 Antiun Ingenieria S.L. - Javier Iniesta
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo.tests.common import TransactionCase


class TestEventRegistrationMailListWizard(TransactionCase):

def setUp(self):
super(TestEventRegistrationMailListWizard, self).setUp()
self.mass_mailing_obj = self.env['mail.mass_mailing']
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)
mass_mailing = self.mass_mailing_obj.search(
[('contact_list_ids', 'in', [self.mail_list.id])])
models = mass_mailing._get_mailing_model()
models_list = [x[0] for x in models]
self.assertTrue('event.registration' in models_list)
72 changes: 72 additions & 0 deletions event_registration_mass_mailing/views/event_registration.xml
@@ -0,0 +1,72 @@
<?xml version="1.0" ?>
<odoo>

<record id="email_template_event_registration" model="mail.template">
<field name="name">Event Registration Mass Mail</field>
<field name="model_id" ref="event.model_event_registration"/>
<field name="auto_delete" eval="True"/>
<field name="partner_to">${object.partner_id.id}</field>
<field name="email_to">${object.email}</field>
</record>

<act_window name="Mass mailing to partners"
res_model="mail.compose.message"
src_model="event.registration"
view_mode="form"
multi="True"
target="new"
key2="client_action_multi"
id="action_event_registration_mass_mail"
context="{
'default_composition_mode': 'mass_mail',
'default_partner_to': '${object.partner_id.id or \'\'}',
'default_use_template': True,
'default_template_id': ref('email_template_event_registration')
}"/>

<act_window name="Add to mailing list"
res_model="event.registration.mail.list.wizard"
src_model="event.registration"
view_mode="form"
multi="True"
target="new"
key2="client_action_multi"
id="action_event_registration_mail_list"/>

<record id="view_registration_search" model="ir.ui.view">
<field name="name">Marketing - Registrations Search</field>
<field name="model">event.registration</field>
<field name="inherit_id" ref="event.view_registration_search"/>
<field name="arch" type="xml">
<filter name="message_needaction" position="before">
<filter string="Available for mass mailing"
name='not_opt_out' domain="[('opt_out', '=', False), ('email', '!=', False)]"
help="Registrations that did not ask not to be included in mass mailing campaigns and has an e-mail set."/>
<separator/>
</filter>
</field>
</record>

<record id="view_event_registration_tree" model="ir.ui.view">
<field name="name">Marketing - Registrations Tree</field>
<field name="model">event.registration</field>
<field name="inherit_id" ref="event.view_event_registration_tree"/>
<field name="arch" type="xml">
<field name="email" position="after">
<field name="opt_out"/>
</field>
</field>
</record>

<record id="view_event_registration_form" model="ir.ui.view">
<field name="name">Marketing - Registrations Form</field>
<field name="model">event.registration</field>
<field name="inherit_id" ref="event.view_event_registration_form"/>
<field name="arch" type="xml">
<field name="email" position="before">
<field name="opt_out"/>
</field>
</field>
</record>

</odoo>
5 changes: 5 additions & 0 deletions event_registration_mass_mailing/wizard/__init__.py
@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright 2016 Antiun Ingenieria S.L. - Javier Iniesta
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import event_registration_mail_list_wizard