Skip to content

Commit

Permalink
[MIG] event_registration_mass_mailing: Migration to 11.0
Browse files Browse the repository at this point in the history
  • Loading branch information
chienandalu authored and pedrobaeza committed Aug 6, 2018
1 parent e1358e5 commit 1016e30
Show file tree
Hide file tree
Showing 13 changed files with 73 additions and 59 deletions.
66 changes: 48 additions & 18 deletions event_registration_mass_mailing/README.rst
Original file line number Diff line number Diff line change
@@ -1,14 +1,38 @@
.. 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 file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fevent-lightgray.png?logo=github
:target: https://github.com/OCA/event/tree/11.0/event_registration_mass_mailing
:alt: OCA/event
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/event-11-0/event-11-0-event_registration_mass_mailing
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/199/11.0
:alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5|

This module adds actions to send mass mailings and allows to add to mailing
lists from event registrations tree view.

**Table of contents**

.. contents::
:local:

Usage
=====

Expand All @@ -18,38 +42,44 @@ Usage
* 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.
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 smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/event/issues/new?body=module:%20event_registration_mass_mailing%0Aversion:%2011.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.

Credits
=======

Authors
~~~~~~~

* Tecnativa

Contributors
------------
~~~~~~~~~~~~

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

Maintainer
----------
Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. 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.
This module is part of the `OCA/event <https://github.com/OCA/event/tree/11.0/event_registration_mass_mailing>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 0 additions & 2 deletions event_registration_mass_mailing/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- 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
Expand Down
6 changes: 2 additions & 4 deletions event_registration_mass_mailing/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
# -*- 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.1',
'version': '11.0.1.0.1',
'depends': [
'event',
'mass_mailing'
'mass_mailing_event',
],
'data': [
'views/event_registration.xml',
Expand Down
2 changes: 0 additions & 2 deletions event_registration_mass_mailing/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import event_registration
from . import mass_mailing
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2016 Antiun Ingenieria S.L. - Javier Iniesta
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

Expand Down
15 changes: 0 additions & 15 deletions event_registration_mass_mailing/models/mass_mailing.py

This file was deleted.

3 changes: 3 additions & 0 deletions event_registration_mass_mailing/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* Javier Iniesta <javieria@antiun.com>
* Vicent Cubells <vicent.cubells@tecnativa.com>
* David Vidal <david.vidal@tecnativa.com>
2 changes: 2 additions & 0 deletions event_registration_mass_mailing/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module adds actions to send mass mailings and allows to add to mailing
lists from event registrations tree view.
5 changes: 5 additions & 0 deletions event_registration_mass_mailing/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
* 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.
1 change: 0 additions & 1 deletion event_registration_mass_mailing/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import test_event_registration_mail_list_wizard
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright 2016 Antiun Ingenieria S.L. - Javier Iniesta
# Copyright 2018 Tecnativa - David Vidal
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo.tests.common import at_install, post_install, TransactionCase
Expand All @@ -16,7 +16,7 @@ def setUp(self):
'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})
'list_ids': [(4, 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',
Expand All @@ -33,8 +33,3 @@ def test_add_to_mail_list(self):
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)
1 change: 0 additions & 1 deletion event_registration_mass_mailing/wizard/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2016 Antiun Ingenieria S.L. - Javier Iniesta
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright 2016 Antiun Ingenieria S.L. - Javier Iniesta
# Copyright 2018 Tecnativa - David Vidal
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import api, fields, models
Expand All @@ -9,11 +9,14 @@ 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")
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):
Expand All @@ -22,13 +25,13 @@ def add_to_mail_list(self):
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)]
('list_ids', 'in', self.mail_list.ids)]
contact_test = contact_obj.search(criteria)
if contact_test:
continue
contact_vals = {
'email': registration.email,
'name': registration.name,
'list_id': self.mail_list.id
'list_ids': [(4, self.mail_list.id)],
}
contact_obj.create(contact_vals)

0 comments on commit 1016e30

Please sign in to comment.