[IMP] mass_mailing: improve displayed info text and KPIs
PURPOSE Clarify the use case in which a specified email address is set as replies may not be traceable. Make the %Click KPIs visible for Emails as well. Allow users to report on the links that have (or not) been clicked from their mailing. SPECIFICATIONS Add an info text for the "specified email address" option in the "reply to" field. If target model does not accept incoming emails warn the user it is likely to fail. Number of emails/sms sent is now display as clickable text instead of stat button and clicked stat button is now also visible in mass_mailing. Task ID: 2202495 PR #48339
This commit is contained in:
committed by
Thibault Delavallée
parent
9d1c3de480
commit
60e4e9912a
@@ -215,7 +215,7 @@
|
||||
</record>
|
||||
<record id="mass_mail_1_stat_5" model="mailing.trace">
|
||||
<field name="mass_mailing_id" ref="mass_mail_1"/>
|
||||
<field name="message_id">1111004@odoo.com</field>
|
||||
<field name="message_id">1111005@odoo.com</field>
|
||||
<field name="model">res.partner</field>
|
||||
<field name="res_id" ref="base.res_partner_address_33"/>
|
||||
<field name="email">julie.richards84@example.com</field>
|
||||
@@ -224,13 +224,22 @@
|
||||
</record>
|
||||
<record id="mass_mail_1_stat_6" model="mailing.trace">
|
||||
<field name="mass_mailing_id" ref="mass_mail_1"/>
|
||||
<field name="message_id">1111004@odoo.com</field>
|
||||
<field name="message_id">1111006@odoo.com</field>
|
||||
<field name="model">res.partner</field>
|
||||
<field name="res_id" ref="base.res_partner_address_34"/>
|
||||
<field name="email">travis.mendoza24@example.com</field>
|
||||
<field name="sent" eval="(DateTime.today() - relativedelta(days=5)).strftime('%Y-%m-%d %H:%M:%S')"/>
|
||||
<field name="bounced" eval="(DateTime.today() - relativedelta(days=3)).strftime('%Y-%m-%d %H:%M:%S')"/>
|
||||
</record>
|
||||
<record id="mass_mail_1_stat_7" model="mailing.trace">
|
||||
<field name="mass_mailing_id" ref="mass_mail_1"/>
|
||||
<field name="message_id">1111007@odoo.com</field>
|
||||
<field name="model">res.partner</field>
|
||||
<field name="res_id" ref="base.res_partner_address_34"/>
|
||||
<field name="email">travis.mendoza24@example.com</field>
|
||||
<field name="sent" eval="False"/>
|
||||
<field name="ignored" eval="(DateTime.today() - relativedelta(days=5)).strftime('%Y-%m-%d %H:%M:%S')"/>
|
||||
</record>
|
||||
|
||||
<!-- Generate some clicks -->
|
||||
<function model="link.tracker.click" name="add_click">
|
||||
|
||||
@@ -315,6 +315,9 @@ class MassMailing(models.Model):
|
||||
def action_view_traces_failed(self):
|
||||
return self._action_view_traces_filtered('failed')
|
||||
|
||||
def action_view_traces_sent(self):
|
||||
return self._action_view_traces_filtered('sent')
|
||||
|
||||
def _action_view_traces_filtered(self, view_filter):
|
||||
action = self.env.ref('mass_mailing.mailing_trace_action').read()[0]
|
||||
action['name'] = _('%s Traces') % (self.name)
|
||||
@@ -323,9 +326,6 @@ class MassMailing(models.Model):
|
||||
action['context'][filter_key] = True
|
||||
return action
|
||||
|
||||
def action_view_sent(self):
|
||||
return self._action_view_documents_filtered('sent')
|
||||
|
||||
def action_view_opened(self):
|
||||
return self._action_view_documents_filtered('opened')
|
||||
|
||||
@@ -342,7 +342,7 @@ class MassMailing(models.Model):
|
||||
return self._action_view_documents_filtered('delivered')
|
||||
|
||||
def _action_view_documents_filtered(self, view_filter):
|
||||
if view_filter in ('sent', 'opened', 'replied', 'bounced', 'clicked'):
|
||||
if view_filter in ('opened', 'replied', 'bounced', 'clicked'):
|
||||
opened_stats = self.mailing_trace_ids.filtered(lambda stat: stat[view_filter])
|
||||
elif view_filter == ('delivered'):
|
||||
opened_stats = self.mailing_trace_ids.filtered(lambda stat: stat.sent and not stat.bounced)
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
|
||||
<field name="state" readonly="1" widget="statusbar"/>
|
||||
</header>
|
||||
<div class="alert alert-info text-center" role="alert" attrs="{'invisible': ['&','&',('ignored', '=', 0),('scheduled', '=', 0),('failed', '=', 0)]}">
|
||||
<div class="alert alert-info text-center" role="alert" attrs="{'invisible': ['&','&','&',('sent', '=', 0),('ignored', '=', 0),('scheduled', '=', 0),('failed', '=', 0)]}">
|
||||
<div attrs="{'invisible': [('ignored', '=', 0)]}">
|
||||
<button class="btn-link py-0"
|
||||
name="action_view_traces_ignored"
|
||||
@@ -78,6 +78,16 @@
|
||||
</strong>
|
||||
</button>
|
||||
</div>
|
||||
<div attrs="{'invisible': ['&', ('sent', '=', 0), ('state', 'in', ('draft', 'test'))]}">
|
||||
<button class="btn-link py-0"
|
||||
name="action_view_traces_sent"
|
||||
type="object">
|
||||
<strong>
|
||||
<field name="sent" class="oe_inline mr-2"/>
|
||||
<span name="sent">emails have been sent.</span>
|
||||
</strong>
|
||||
</button>
|
||||
</div>
|
||||
<div attrs="{'invisible': ['|', ('state', '!=', 'done'), ('failed', '=', 0)]}">
|
||||
<button class="btn-link py-0"
|
||||
name="action_view_traces_failed"
|
||||
@@ -97,15 +107,8 @@
|
||||
</div>
|
||||
<sheet>
|
||||
<div class="oe_button_box" name="button_box">
|
||||
<button name="action_view_sent"
|
||||
id="button_view_sent"
|
||||
type="object"
|
||||
context="{'search_default_filter_sent': True}"
|
||||
icon="fa-envelope-o" class="oe_stat_button"
|
||||
attrs="{'invisible': ['&', ('sent', '=', 0), ('state', 'in', ('draft', 'test'))]}" >
|
||||
<field name="sent" string="Sent" widget="statinfo"/>
|
||||
</button>
|
||||
<button name="action_view_delivered"
|
||||
id="button_view_delivered"
|
||||
type="object"
|
||||
context="{'search_default_filter_delivered': True}"
|
||||
attrs="{'invisible': [('state', 'in', ('draft','test'))]}"
|
||||
@@ -119,6 +122,13 @@
|
||||
class="oe_stat_button">
|
||||
<field name="opened_ratio" string="Opened" widget="percentpie"/>
|
||||
</button>
|
||||
<button name="action_view_clicked"
|
||||
type="object"
|
||||
context="{'search_default_filter_clicked': True}"
|
||||
attrs="{'invisible': [('state', 'in', ('draft','test'))]}"
|
||||
class="oe_stat_button">
|
||||
<field name="clicks_ratio" string="Clicked" widget="percentpie"/>
|
||||
</button>
|
||||
<button name="action_view_replied"
|
||||
type="object"
|
||||
context="{'search_default_filter_replied': True}"
|
||||
@@ -212,6 +222,13 @@
|
||||
'invisible': [('reply_to_mode', '=', 'thread')],
|
||||
'readonly': [('state', 'in', ('sending', 'done'))]
|
||||
}"/>
|
||||
<div style="margin-top:-5px">
|
||||
<small class="oe_edit_only text-muted mb-2"
|
||||
style="font-size:74%"
|
||||
attrs="{'invisible': ['|', ('reply_to_mode', '=', 'thread'), ('mailing_model_name', 'in', ['mailing.contact', 'res.partner', 'mailing.list'])],}">
|
||||
To track replies, this address must belong to this database.
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
<label for="attachment_ids"/>
|
||||
<div name="attachment_ids_details">
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<field name="model">mailing.mailing</field>
|
||||
<field name="inherit_id" ref="mass_mailing.view_mail_mass_mailing_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//button[@id='button_view_sent']" position="before">
|
||||
<xpath expr="//button[@id='button_view_delivered']" position="before">
|
||||
<button name="action_redirect_to_leads_and_opportunities"
|
||||
type="object"
|
||||
icon="fa-star"
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<field name="model">mailing.mailing</field>
|
||||
<field name="inherit_id" ref="mass_mailing.view_mail_mass_mailing_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//button[@id='button_view_sent']" position="before">
|
||||
<xpath expr="//button[@id='button_view_delivered']" position="before">
|
||||
<button name="action_redirect_to_quotations"
|
||||
type="object"
|
||||
icon="fa-pencil"
|
||||
|
||||
@@ -67,6 +67,12 @@
|
||||
<xpath expr="//span[@name='scheduled_text']" position="after">
|
||||
<span name="scheduled_text_sms" attrs="{'invisible': [('mailing_type', '!=', 'sms')]}">SMS Text Message are in queue and will be sent soon.</span>
|
||||
</xpath>
|
||||
<xpath expr="//span[@name='sent']" position="attributes">
|
||||
<attribute name="attrs">{'invisible': [('mailing_type', '!=', 'mail')]}</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//span[@name='sent']" position="after">
|
||||
<span name="sent_sms" attrs="{'invisible': [('mailing_type', '!=', 'sms')]}">SMS Text Message have been sent.</span>
|
||||
</xpath>
|
||||
<xpath expr="//span[@name='failed_text']" position="attributes">
|
||||
<attribute name="attrs">{'invisible': [('mailing_type', '!=', 'mail')]}</attribute>
|
||||
</xpath>
|
||||
@@ -80,27 +86,6 @@
|
||||
<span name="next_departure_text" attrs="{'invisible': [('mailing_type', '!=', 'sms')]}">This SMS marketing is scheduled for </span>
|
||||
</xpath>
|
||||
<!-- Stat Buttons -->
|
||||
<xpath expr="//button[@id='button_view_sent']" position="attributes">
|
||||
<attribute name="attrs">{'invisible': ['|', '&', ('sent', '=', 0), ('state', 'in', ('draft', 'test')), ('mailing_type', '!=', 'mail')]}</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//button[@id='button_view_sent']" position="after">
|
||||
<button name="action_view_sent"
|
||||
type="object"
|
||||
context="{'search_default_filter_sent': True}"
|
||||
icon="fa-comment-o" class="oe_stat_button"
|
||||
attrs="{'invisible': ['|', '&', ('sent', '=', 0), ('state', 'in', ('draft', 'test')), ('mailing_type', '!=', 'sms')]}" >
|
||||
<field name="sent" string="Sent" widget="statinfo"/>
|
||||
</button>
|
||||
</xpath>
|
||||
<xpath expr="//button[@name='action_view_opened']" position="after">
|
||||
<button name="action_view_clicked"
|
||||
type="object"
|
||||
context="{'search_default_filter_clicked': True}"
|
||||
class="oe_stat_button"
|
||||
attrs="{'invisible': ['|',('mailing_type', '!=', 'sms'),('state', 'in', ('draft','test'))]}">
|
||||
<field name="clicks_ratio" string="Clicked" widget="percentpie"/>
|
||||
</button>
|
||||
</xpath>
|
||||
<xpath expr="//button[@name='action_view_opened']" position="attributes">
|
||||
<attribute name="attrs">{'invisible': ['|',('mailing_type', '!=', 'mail'),('state', 'in', ('draft','test'))]}</attribute>
|
||||
</xpath>
|
||||
|
||||
Reference in New Issue
Block a user