[ADD] mass_mailing_event: add mass mailing UX on event for attendees

If the event has some attendees a button is displayed to launch a mass
mailing on those attendees. This button requires a new bridge module
between mass mailing and event.
This commit is contained in:
Thibault Delavallée
2017-04-18 15:32:51 +02:00
parent dce1a52b8b
commit 7d3ffc294f
5 changed files with 69 additions and 0 deletions
+4
View File
@@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import models
+20
View File
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Mass mailing on attendees',
'category': 'Hidden',
'version': '1.0',
'description':
"""
Mass mail event attendees
=========================
Bridge module adding UX requirements to ease mass mailing of event attendees.
""",
'depends': ['event', 'mass_mailing'],
'data': [
'views/event_views.xml'
],
'auto_install': True,
}
@@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import event
+23
View File
@@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models
class Event(models.Model):
_inherit = "event.event"
def action_mass_mailing_attendees(self):
mass_mailing_action = dict(
name='Mass Mail Attendees',
type='ir.actions.act_window',
res_model='mail.mass_mailing',
view_type='form',
view_mode='form',
target='current',
context=dict(
default_mailing_model='event.registration',
default_mailing_domain="[('event_id', 'in', %s)]" % self.ids, # , ('state', 'in', ['draft', 'open', 'done'])
),
)
return mass_mailing_action
@@ -0,0 +1,18 @@
<?xml version="1.0"?>
<odoo>
<record id="event_event_view_form_inherit_mass_mailing" model="ir.ui.view">
<field name="name">event.event.view.form.inherit.mass.mailing</field>
<field name="model">event.event</field>
<field name="inherit_id" ref="event.view_event_form"/>
<field name="arch" type="xml">
<button name="%(event.act_event_registration_from_event)d" position="after">
<button class="oe_stat_button" type="object"
name="action_mass_mailing_attendees"
icon="fa-envelope-o"
attrs="{'invisible': [('seats_expected', '=', 0)]}">
Mail Attendees
</button>
</button>
</field>
</record>
</odoo>