[IMP] mass_mailing: form view improvements using stat button + failed tracking
on statistics. This comes with a web branch to fixes the statbuttons. bzr revid: tde@openerp.com-20140408113029-ezjlbzbn3j26f43w
This commit is contained in:
parent
e3d31b5dce
commit
58e53d2e31
|
@ -73,4 +73,6 @@ class MailMail(osv.Model):
|
||||||
def _postprocess_sent_message(self, cr, uid, mail, context=None, mail_sent=True):
|
def _postprocess_sent_message(self, cr, uid, mail, context=None, mail_sent=True):
|
||||||
if mail_sent is True and mail.statistics_ids:
|
if mail_sent is True and mail.statistics_ids:
|
||||||
self.pool['mail.mail.statistics'].write(cr, uid, [s.id for s in mail.statistics_ids], {'sent': fields.datetime.now()}, context=context)
|
self.pool['mail.mail.statistics'].write(cr, uid, [s.id for s in mail.statistics_ids], {'sent': fields.datetime.now()}, context=context)
|
||||||
|
elif mail_sent is False and mail.statistics_ids:
|
||||||
|
self.pool['mail.mail.statistics'].write(cr, uid, [s.id for s in mail.statistics_ids], {'exception': fields.datetime.now()}, context=context)
|
||||||
return super(MailMail, self)._postprocess_sent_message(cr, uid, mail, context=context, mail_sent=mail_sent)
|
return super(MailMail, self)._postprocess_sent_message(cr, uid, mail, context=context, mail_sent=mail_sent)
|
||||||
|
|
|
@ -238,13 +238,16 @@ class MassMailingCampaign(osv.Model):
|
||||||
Statistics = self.pool['mail.mail.statistics']
|
Statistics = self.pool['mail.mail.statistics']
|
||||||
results = dict.fromkeys(ids, False)
|
results = dict.fromkeys(ids, False)
|
||||||
for cid in ids:
|
for cid in ids:
|
||||||
|
stat_ids = Statistics.search(cr, uid, [('mass_mailing_campaign_id', '=', cid)], context=context),
|
||||||
|
stats = Statistics.browse(cr, uid, stat_ids, context=context)
|
||||||
results[cid] = {
|
results[cid] = {
|
||||||
'total': Statistics.search(cr, uid, [('mass_mailing_campaign_id', '=', cid)], count=True, context=context),
|
'total': len(stats),
|
||||||
'scheduled': Statistics.search(cr, uid, [('mass_mailing_campaign_id', '=', cid), ('scheduled', '!=', False), ('sent', '=', False)], count=True, context=context),
|
'failed': len([s for s in stats if not s.scheduled is False and s.sent is False and not s.exception is False]),
|
||||||
'sent': Statistics.search(cr, uid, [('mass_mailing_campaign_id', '=', cid), ('sent', '!=', False)], count=True, context=context),
|
'scheduled': len([s for s in stats if not s.scheduled is False and s.sent is False]),
|
||||||
'opened': Statistics.search(cr, uid, [('mass_mailing_campaign_id', '=', cid), ('opened', '!=', False)], count=True, context=context),
|
'sent': len([s for s in stats if not s.sent is False]),
|
||||||
'replied': Statistics.search(cr, uid, [('mass_mailing_campaign_id', '=', cid), ('replied', '!=', False)], count=True, context=context),
|
'opened': len([s for s in stats if not s.opened is False]),
|
||||||
'bounced': Statistics.search(cr, uid, [('mass_mailing_campaign_id', '=', cid), ('bounced', '!=', False)], count=True, context=context),
|
'replied': len([s for s in stats if not s.replied is False]),
|
||||||
|
'bounced': len([s for s in stats if not s.bounced is False]),
|
||||||
}
|
}
|
||||||
results[cid]['delivered'] = results[cid]['sent'] - results[cid]['bounced']
|
results[cid]['delivered'] = results[cid]['sent'] - results[cid]['bounced']
|
||||||
results[cid]['received_ratio'] = 100.0 * results[cid]['delivered'] / (results[cid]['sent'] or 1)
|
results[cid]['received_ratio'] = 100.0 * results[cid]['delivered'] / (results[cid]['sent'] or 1)
|
||||||
|
@ -278,7 +281,11 @@ class MassMailingCampaign(osv.Model):
|
||||||
type='integer', multi='_get_statistics'
|
type='integer', multi='_get_statistics'
|
||||||
),
|
),
|
||||||
'scheduled': fields.function(
|
'scheduled': fields.function(
|
||||||
_get_statistics, string='Total',
|
_get_statistics, string='Scheduled',
|
||||||
|
type='integer', multi='_get_statistics'
|
||||||
|
),
|
||||||
|
'failed': fields.function(
|
||||||
|
_get_statistics, string='Failed',
|
||||||
type='integer', multi='_get_statistics'
|
type='integer', multi='_get_statistics'
|
||||||
),
|
),
|
||||||
'sent': fields.function(
|
'sent': fields.function(
|
||||||
|
@ -419,13 +426,16 @@ class MassMailing(osv.Model):
|
||||||
Statistics = self.pool['mail.mail.statistics']
|
Statistics = self.pool['mail.mail.statistics']
|
||||||
results = dict.fromkeys(ids, False)
|
results = dict.fromkeys(ids, False)
|
||||||
for mid in ids:
|
for mid in ids:
|
||||||
|
stat_ids = Statistics.search(cr, uid, [('mass_mailing_id', '=', mid)], context=context)
|
||||||
|
stats = Statistics.browse(cr, uid, stat_ids, context=context)
|
||||||
results[mid] = {
|
results[mid] = {
|
||||||
'total': Statistics.search(cr, uid, [('mass_mailing_id', '=', mid)], count=True, context=context),
|
'total': len(stats),
|
||||||
'scheduled': Statistics.search(cr, uid, [('mass_mailing_id', '=', mid), ('scheduled', '!=', False), ('sent', '=', False)], count=True, context=context),
|
'failed': len([s for s in stats if not s.scheduled is False and s.sent is False and not s.exception is False]),
|
||||||
'sent': Statistics.search(cr, uid, [('mass_mailing_id', '=', mid), ('sent', '!=', False)], count=True, context=context),
|
'scheduled': len([s for s in stats if not s.scheduled is False and s.sent is False]),
|
||||||
'opened': Statistics.search(cr, uid, [('mass_mailing_id', '=', mid), ('opened', '!=', False)], count=True, context=context),
|
'sent': len([s for s in stats if not s.sent is False]),
|
||||||
'replied': Statistics.search(cr, uid, [('mass_mailing_id', '=', mid), ('replied', '!=', False)], count=True, context=context),
|
'opened': len([s for s in stats if not s.opened is False]),
|
||||||
'bounced': Statistics.search(cr, uid, [('mass_mailing_id', '=', mid), ('bounced', '!=', False)], count=True, context=context),
|
'replied': len([s for s in stats if not s.replied is False]),
|
||||||
|
'bounced': len([s for s in stats if not s.bounced is False]),
|
||||||
}
|
}
|
||||||
results[mid]['delivered'] = results[mid]['sent'] - results[mid]['bounced']
|
results[mid]['delivered'] = results[mid]['sent'] - results[mid]['bounced']
|
||||||
results[mid]['received_ratio'] = 100.0 * results[mid]['delivered'] / (results[mid]['sent'] or 1)
|
results[mid]['received_ratio'] = 100.0 * results[mid]['delivered'] / (results[mid]['sent'] or 1)
|
||||||
|
@ -449,7 +459,7 @@ class MassMailing(osv.Model):
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def _get_private_models(self, context=None):
|
def _get_private_models(self, context=None):
|
||||||
return ['res.partner', 'mail.maass_mailing.contact']
|
return ['res.partner', 'mail.mass_mailing.contact']
|
||||||
|
|
||||||
def _get_auto_reply_to_available(self, cr, uid, ids, name, arg, context=None):
|
def _get_auto_reply_to_available(self, cr, uid, ids, name, arg, context=None):
|
||||||
res = dict.fromkeys(ids, False)
|
res = dict.fromkeys(ids, False)
|
||||||
|
@ -537,6 +547,10 @@ class MassMailing(osv.Model):
|
||||||
_get_statistics, string='Scheduled',
|
_get_statistics, string='Scheduled',
|
||||||
type='integer', multi='_get_statistics',
|
type='integer', multi='_get_statistics',
|
||||||
),
|
),
|
||||||
|
'failed': fields.function(
|
||||||
|
_get_statistics, string='Failed',
|
||||||
|
type='integer', multi='_get_statistics',
|
||||||
|
),
|
||||||
'sent': fields.function(
|
'sent': fields.function(
|
||||||
_get_statistics, string='Sent',
|
_get_statistics, string='Sent',
|
||||||
type='integer', multi='_get_statistics',
|
type='integer', multi='_get_statistics',
|
||||||
|
@ -868,6 +882,7 @@ class MailMailStats(osv.Model):
|
||||||
# Bounce and tracking
|
# Bounce and tracking
|
||||||
'scheduled': fields.datetime('Scheduled', help='Date when the email has been created'),
|
'scheduled': fields.datetime('Scheduled', help='Date when the email has been created'),
|
||||||
'sent': fields.datetime('Sent', help='Date when the email has been sent'),
|
'sent': fields.datetime('Sent', help='Date when the email has been sent'),
|
||||||
|
'exception': fields.datetime('Exception', help='Date of technical error leading to the email not being sent'),
|
||||||
'opened': fields.datetime('Opened', help='Date when the email has been opened the first time'),
|
'opened': fields.datetime('Opened', help='Date when the email has been opened the first time'),
|
||||||
'replied': fields.datetime('Replied', help='Date when this email has been replied for the first time.'),
|
'replied': fields.datetime('Replied', help='Date when this email has been replied for the first time.'),
|
||||||
'bounced': fields.datetime('Bounced', help='Date when this email has bounced.'),
|
'bounced': fields.datetime('Bounced', help='Date when this email has bounced.'),
|
||||||
|
|
|
@ -3,19 +3,6 @@
|
||||||
min-height: 270px !important;
|
min-height: 270px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.form_html_preview {
|
|
||||||
width: 600px;
|
|
||||||
max-height: 1000px;
|
|
||||||
-webkit-transform: scale(.50);
|
|
||||||
-ms-transform: scale(.50);
|
|
||||||
transform: scale(.50);
|
|
||||||
-webkit-transform-origin: 0 0;
|
|
||||||
-ms-transform-origin: 0 0;
|
|
||||||
transform-origin: 0 0;
|
|
||||||
margin: 0 0px -300px 0;
|
|
||||||
overflow: visible !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.kanban_html_preview {
|
.kanban_html_preview {
|
||||||
width: 600px;
|
width: 600px;
|
||||||
height: 600px;
|
height: 600px;
|
||||||
|
|
|
@ -229,33 +229,43 @@
|
||||||
</group>
|
</group>
|
||||||
<group>
|
<group>
|
||||||
<field name="total" invisible="1"/>
|
<field name="total" invisible="1"/>
|
||||||
<div class="oe_right oe_button_box" name="buttons"
|
<div class="oe_right oe_button_box" name="buttons">
|
||||||
attrs="{'invisible': [('total', '=', 0)]}">
|
<div>
|
||||||
<button name="%(action_mail_mass_mailing_report)d"
|
<button name="action_see_recipients" type="object"
|
||||||
type="action" class="oe_stat_button oe_inline">
|
icon="fa-user" class="oe_stat_button">
|
||||||
<field name="received_ratio" widget="percentpie"/>
|
<field name="contact_nbr" string="Recipients" widget="statinfo"/>
|
||||||
<span>Received</span>
|
</button>
|
||||||
</button>
|
<button name="%(action_mail_mass_mailing_report)d" type="action"
|
||||||
<button name="%(action_mail_mass_mailing_report)d"
|
icon="fa-envelope-o" class="oe_stat_button">
|
||||||
type="action" class="oe_stat_button oe_inline">
|
<field name="total" string="Emails" widget="statinfo"/>
|
||||||
<field name="opened_ratio" widget="percentpie"/>
|
</button>
|
||||||
<span>Opened</span>
|
</div>
|
||||||
</button>
|
<div style="margin-top: 8px;"
|
||||||
<button name="%(action_mail_mass_mailing_report)d"
|
attrs="{'invisible': [('total', '=', 0)]}">
|
||||||
type="action" class="oe_stat_button oe_inline">
|
<button name="%(action_mail_mass_mailing_report)d"
|
||||||
<field name="replied_ratio" widget="percentpie"/>
|
type="action" class="oe_stat_button">
|
||||||
<span>Replied</span>
|
<field name="received_ratio" string="Received" widget="percentpie"/>
|
||||||
</button>
|
</button>
|
||||||
|
<button name="%(action_mail_mass_mailing_report)d"
|
||||||
<button name="%(action_mail_mass_mailing_report)d"
|
type="action" class="oe_stat_button">
|
||||||
string="cacaprout"
|
<field name="opened_ratio" string="Opened" widget="percentpie"/>
|
||||||
type="action" class="oe_stat_button oe_inline">
|
</button>
|
||||||
<field name="opened_dayly" widget="barchart"/>
|
<button name="%(action_mail_mass_mailing_report)d"
|
||||||
<!-- <span>Opened Daily</span> -->
|
type="action" class="oe_stat_button">
|
||||||
</button>
|
<field name="replied_ratio" string="Replied" widget="percentpie"/>
|
||||||
<!-- <p colspan="2">Here be some bar charts</p> -->
|
</button>
|
||||||
<!-- <field name="opened_dayly" attrs="{'invisible': [('total', '=', 0)]}"/>
|
</div>
|
||||||
<field name="replied_dayly" attrs="{'invisible': [('total', '=', 0)]}"/> -->
|
<div style="margin-top: 8px;"
|
||||||
|
attrs="{'invisible': [('total', '=', 0)]}">
|
||||||
|
<button name="%(action_mail_mass_mailing_report)d"
|
||||||
|
type="action" class="oe_stat_button oe_inline">
|
||||||
|
<field name="opened_dayly" string="Opened Daily" widget="barchart"/>
|
||||||
|
</button>
|
||||||
|
<button name="%(action_mail_mass_mailing_report)d"
|
||||||
|
type="action" class="oe_stat_button oe_inline">
|
||||||
|
<field name="replied_dayly" string="Replied Daily" widget="barchart"/>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
|
@ -265,8 +275,13 @@
|
||||||
<field name="auto_reply_to_available" invisible="1"/>
|
<field name="auto_reply_to_available" invisible="1"/>
|
||||||
<field name="reply_in_thread" class="oe_inline"
|
<field name="reply_in_thread" class="oe_inline"
|
||||||
on_change="on_change_reply_in_thread(reply_specified, reply_in_thread, context)"
|
on_change="on_change_reply_in_thread(reply_specified, reply_in_thread, context)"
|
||||||
attrs="{'readonly': [('auto_reply_to_available', '=', False)]}"/> Replies go into the original document
|
attrs="{'readonly': [('auto_reply_to_available', '=', False)]}"/>
|
||||||
<span attrs="{'invisible': [('auto_reply_to_available', '=', True)]}"> (not available for those recipients)</span>
|
<span attrs="{'invisible': [('auto_reply_to_available', '=', False)]}">
|
||||||
|
Replies go into the original document
|
||||||
|
</span>
|
||||||
|
<span class="oe_grey" attrs="{'invisible': [('auto_reply_to_available', '=', True)]}">
|
||||||
|
Replies go into the original document (not available for those recipients)
|
||||||
|
</span>
|
||||||
<br />
|
<br />
|
||||||
<field name="reply_specified" class="oe_inline"
|
<field name="reply_specified" class="oe_inline"
|
||||||
on_change="on_change_reply_specified(reply_specified, reply_in_thread, context)"/> Use a specific reply-to address
|
on_change="on_change_reply_specified(reply_specified, reply_in_thread, context)"/> Use a specific reply-to address
|
||||||
|
@ -279,16 +294,16 @@
|
||||||
<field name="mailing_model" widget="radio"
|
<field name="mailing_model" widget="radio"
|
||||||
on_change='on_change_mailing_model(mailing_model, context)'/>
|
on_change='on_change_mailing_model(mailing_model, context)'/>
|
||||||
|
|
||||||
<label for="contact_list_ids" string="Mailing Lists"/>
|
<label for="contact_list_ids" string="Mailing Lists" style="display: inline-block; min-width: 90px;"/>
|
||||||
<field name="contact_list_ids" widget="many2many_tags" options="{'no_create': True}"
|
<field name="contact_list_ids" widget="many2many_tags" options="{'no_create': True}"
|
||||||
class="oe_inline" placeholder="Choose mailing lists"
|
class="oe_inline" placeholder="Choose mailing lists"
|
||||||
on_change="on_change_contact_list_ids(mailing_model, contact_list_ids, context)"/>
|
on_change="on_change_contact_list_ids(mailing_model, contact_list_ids, context)"/>
|
||||||
<span style="margin-left: 8px; margin-right: 8px">or</span>
|
<span style="margin-left: 8px; margin-right: 8px">or</span>
|
||||||
<button string='Create a New List' class="oe_link" type='object' name='action_new_list'/><br />
|
<button string='Create a New List' class="oe_link" type='object' name='action_new_list'/><br />
|
||||||
|
|
||||||
<label for="contact_nbr" string="Total"/>
|
<!-- <label for="contact_nbr" string="Total" style="display: inline-block; min-width: 90px;"/> -->
|
||||||
<field name="contact_nbr" nolabel="1" class="oe_inline" readonly="True"/> recipients
|
<!-- <field name="contact_nbr" nolabel="1" class="oe_inline" readonly="True"/> recipients -->
|
||||||
<button name="action_see_recipients" type="object" string="See Recipients" class="oe_inline oe_link" style='margin-left: 8px;'/><br />
|
<!-- <button name="action_see_recipients" type="object" string="See Recipients" class="oe_inline oe_link" style='margin-left: 8px;'/><br /> -->
|
||||||
|
|
||||||
<div groups="mass_mailing.group_mass_mailing_campaign" style="display: inline;">
|
<div groups="mass_mailing.group_mass_mailing_campaign" style="display: inline;">
|
||||||
<field name="ab_testing" invisible="1"/>
|
<field name="ab_testing" invisible="1"/>
|
||||||
|
@ -305,11 +320,12 @@
|
||||||
</div>
|
</div>
|
||||||
<field name="date" readonly="True" groups="mass_mailing.group_mass_mailing_campaign"/>
|
<field name="date" readonly="True" groups="mass_mailing.group_mass_mailing_campaign"/>
|
||||||
<field name="mass_mailing_campaign_id" groups="mass_mailing.group_mass_mailing_campaign"/>
|
<field name="mass_mailing_campaign_id" groups="mass_mailing.group_mass_mailing_campaign"/>
|
||||||
<label for="template_id"/>
|
<label for="body_html" string="Email"/>
|
||||||
<div style="max-height: 200px; overflow: hidden !important;">
|
<div>
|
||||||
<field name="template_id" string="Select Template" nolabel="1"
|
<label for="template_id" string="Template"/>
|
||||||
|
<field name="template_id" string="Select Template"
|
||||||
class="oe_inline" options="{'no_create': True, 'no_open': True}"
|
class="oe_inline" options="{'no_create': True, 'no_open': True}"
|
||||||
on_change="on_change_template_id(template_id, context)"/>
|
on_change="on_change_template_id(template_id, context)"/><br />
|
||||||
<button name="action_edit_html" type="object" string="Edit Mail Content"
|
<button name="action_edit_html" type="object" string="Edit Mail Content"
|
||||||
class="oe_link" style="margin-left: 8px"/>
|
class="oe_link" style="margin-left: 8px"/>
|
||||||
<field name="body_html"/>
|
<field name="body_html"/>
|
||||||
|
|
Loading…
Reference in New Issue