[ADD] mass_mailing_event_track: add mass mailing UX on event for track speakers

If the event has some tracks a button is displayed to launch a mass
mailing on those speakers. This button requires a new bridge module
between mass mailing and website_event_track.
This commit is contained in:
Thibault Delavallée
2017-04-18 15:33:12 +02:00
parent 7d3ffc294f
commit f93c4f4262
5 changed files with 70 additions and 0 deletions
@@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import models
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Mass mailing on track speakers',
'category': 'Hidden',
'version': '1.0',
'description':
"""
Mass mail event track speakers
==============================
Bridge module adding UX requirements to ease mass mailing of event track speakers.
""",
'depends': ['website_event_track', '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
@@ -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_track_speakers(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.track',
default_mailing_domain="[('event_id', 'in', %s), ('stage_id.is_cancel', '!=', True)]" % self.ids,
),
)
return mass_mailing_action
@@ -0,0 +1,19 @@
<?xml version="1.0"?>
<odoo>
<record id="event_event_view_form_inherit_mass_mailing_track" model="ir.ui.view">
<field name="name">event.event.view.form.inherit.mass.mailing.track</field>
<field name="model">event.event</field>
<field name="inherit_id" ref="website_event_track.view_event_form"/>
<field name="arch" type="xml">
<button name="%(website_event_track.action_event_track_from_event)d" position="after">
<button class="oe_stat_button" type="object"
name="action_mass_mailing_track_speakers"
string="Mail Track Speakers"
icon="fa-envelope-o"
attrs="{'invisible': [('track_count', '=', 0)]}">
Mail Track Speakers
</button>
</button>
</field>
</record>
</odoo>