[IMP] {mass_mailing}_sms: update the embed tree view on campaign
This commit improves the embedded tree view of mailings, sms within a campaign, and makes it uniform with the original tree views. However, due to lack of space, we display the stats simply in numeric format instead using progressbar widget. Also, to save a bit space, if no mailing, sms has A/B testing enabled, we hide that column. Apart from that we have added sum for the field `sent` and average for these fields, - recieved_ratio - opened_ratio - clicks_ratio - replied_ratio - clicked - bounced TaskID-2653806 Part-of: odoo/odoo#77768
This commit is contained in:
committed by
Dharmraj Jhala
parent
d0f25aa59a
commit
87e538dd1d
@@ -215,23 +215,6 @@
|
||||
font-size: 90%;
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 1200px) {
|
||||
.o_utm_campaign_mass_mailing_substats {
|
||||
padding-right: 210px;
|
||||
div {
|
||||
margin-left: 50px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 768px) and (max-width: 1200px) {
|
||||
.o_utm_campaign_mass_mailing_substats {
|
||||
padding-right: 180px;
|
||||
div {
|
||||
margin-left: 30px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.o_mailing_contact_import_list {
|
||||
min-height: 150px;
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
@include media-breakpoint-down(md) {
|
||||
.o_utm_campaign_mass_mailing_substats {
|
||||
width: 80%;
|
||||
margin: 0 auto;
|
||||
justify-content: space-between !important;
|
||||
}
|
||||
// For field to occupy full width in small devices. We need '!important'
|
||||
// here because of the 'w-auto' class used in the view.
|
||||
.o_form_editable div[name="mailing_filter_id"] {
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
attrs="{'invisible': ['|', ('mailing_mail_count', '=', 0), ('is_mailing_campaign_activated', '=', False)]}"
|
||||
groups="mass_mailing.group_mass_mailing_user">
|
||||
<field name="mailing_mail_count" widget="statinfo" string="Mailings"/>
|
||||
<field name="ab_testing_mailings_count" invisible="1"/>
|
||||
</button>
|
||||
</xpath>
|
||||
<xpath expr="//notebook" position="inside">
|
||||
@@ -25,54 +26,23 @@
|
||||
groups="mass_mailing.group_mass_mailing_user">
|
||||
<field name="mailing_mail_ids" readonly="1" nolabel="1">
|
||||
<tree>
|
||||
<field name="subject"/>
|
||||
<field name="sent_date"/>
|
||||
<field name="state"/>
|
||||
<field name="delivered"/>
|
||||
<field name="opened"/>
|
||||
<field name="replied"/>
|
||||
<field name="bounced"/>
|
||||
<field name="calendar_date" string="Date"/>
|
||||
<field name="subject" attrs="{'readonly': [('state', 'in', ('sending', 'done'))]}"/>
|
||||
<field name="mailing_model_id" string="Recipients" optional="hide"/>
|
||||
<field name="user_id" widget="many2one_avatar_user"/>
|
||||
<field name="ab_testing_enabled" string="A/B Test"
|
||||
groups="mass_mailing.group_mass_mailing_campaign"
|
||||
attrs="{'column_invisible': [('parent.ab_testing_mailings_count', '=', 0)]}"/>
|
||||
<field name="campaign_id" string="Campaign" groups="mass_mailing.group_mass_mailing_campaign" optional="hide"/>
|
||||
<field name="received_ratio" string="Delivered (%)" avg="Average of Delivered"/>
|
||||
<field name="opened_ratio" string="Opened (%)" avg="Average of Opened"/>
|
||||
<field name="bounced_ratio" string="Bounced (%)" optional="hide" avg="Average of Bounced"/>
|
||||
<field name="clicks_ratio" string="Clicked (%)" avg="Average of Clicked"/>
|
||||
<field name="replied_ratio" string="Replied (%)" avg="Average of Replied"/>
|
||||
<field name="state" decoration-info="state in ('draft', 'in_queue')" decoration-success="state in ('sending', 'done')" widget="badge"/>
|
||||
<button name="action_duplicate" type="object" string="Duplicate"/>
|
||||
</tree>
|
||||
</field>
|
||||
<div class="o_utm_campaign_mass_mailing_substats d-flex justify-content-end align-items-center">
|
||||
<div class="d-flex justify-content-end align-items-center flex-column">
|
||||
<label for="received_ratio" string="Delivered" class="m-0"/>
|
||||
<div class="m-0">
|
||||
<span class="text-end">
|
||||
<field name="received_ratio"/>
|
||||
<span>%</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex justify-content-end align-items-center flex-column">
|
||||
<label for="opened_ratio" string="Opened" class="m-0"/>
|
||||
<div class="m-0">
|
||||
<span class="text-end">
|
||||
<field name="opened_ratio"/>
|
||||
<span>%</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex justify-content-end align-items-center flex-column">
|
||||
<label for="replied_ratio" string="Replied" class="m-0"/>
|
||||
<div class="m-0">
|
||||
<span class="text-end">
|
||||
<field name="replied_ratio"/>
|
||||
<span>%</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex justify-content-end align-items-center flex-column">
|
||||
<label for="bounced_ratio" string="Bounced" class="m-0"/>
|
||||
<div class="m-0">
|
||||
<span class="text-end">
|
||||
<field name="bounced_ratio"/>
|
||||
<span>%</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</page>
|
||||
</xpath>
|
||||
</field>
|
||||
|
||||
@@ -18,6 +18,7 @@ class UtmCampaign(models.Model):
|
||||
groups="mass_mailing.group_mass_mailing_user")
|
||||
|
||||
# A/B Testing
|
||||
ab_testing_mailings_sms_count = fields.Integer("A/B Test Mailings SMS #", compute="_compute_mailing_sms_count")
|
||||
ab_testing_sms_winner_selection = fields.Selection([
|
||||
('manual', 'Manual'),
|
||||
('clicks_ratio', 'Highest Click Rate')], string="SMS Winner Selection", default="clicks_ratio")
|
||||
@@ -32,8 +33,25 @@ class UtmCampaign(models.Model):
|
||||
|
||||
@api.depends('mailing_sms_ids')
|
||||
def _compute_mailing_sms_count(self):
|
||||
if self.ids:
|
||||
mailing_sms_data = self.env['mailing.mailing'].read_group(
|
||||
[('campaign_id', 'in', self.ids), ('mailing_type', '=', 'sms')],
|
||||
['campaign_id', 'ab_testing_enabled'],
|
||||
['campaign_id', 'ab_testing_enabled'],
|
||||
lazy=False,
|
||||
)
|
||||
ab_testing_mapped_sms_data = {}
|
||||
mapped_sms_data = {}
|
||||
for data in mailing_sms_data:
|
||||
if data['ab_testing_enabled']:
|
||||
ab_testing_mapped_sms_data.setdefault(data['campaign_id'][0], []).append(data['__count'])
|
||||
mapped_sms_data.setdefault(data['campaign_id'][0], []).append(data['__count'])
|
||||
else:
|
||||
mapped_sms_data = dict()
|
||||
ab_testing_mapped_sms_data = dict()
|
||||
for campaign in self:
|
||||
campaign.mailing_sms_count = len(campaign.mailing_sms_ids)
|
||||
campaign.mailing_sms_count = sum(mapped_sms_data.get(campaign.id, []))
|
||||
campaign.ab_testing_mailings_sms_count = sum(ab_testing_mapped_sms_data.get(campaign.id, []))
|
||||
|
||||
def action_create_mass_sms(self):
|
||||
action = self.env["ir.actions.actions"]._for_xml_id("mass_mailing.action_create_mass_mailings_from_campaign")
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
attrs="{'invisible': ['|', ('mailing_sms_count', '=', 0), ('is_mailing_campaign_activated', '=', False)]}"
|
||||
icon="fa-mobile" groups="mass_mailing.group_mass_mailing_user">
|
||||
<field name="mailing_sms_count" widget="statinfo" string="SMS"/>
|
||||
<field name="ab_testing_mailings_sms_count" invisible="1"/>
|
||||
</button>
|
||||
</xpath>
|
||||
<xpath expr="//notebook" position="inside">
|
||||
@@ -26,11 +27,19 @@
|
||||
<group>
|
||||
<field name="mailing_sms_ids" readonly="1" nolabel="1">
|
||||
<tree>
|
||||
<field name="subject"/>
|
||||
<field name="sent_date"/>
|
||||
<field name="state"/>
|
||||
<field name="bounced"/>
|
||||
<field name="delivered"/>
|
||||
<field name="calendar_date" string="Date"/>
|
||||
<field name="subject" string="Title"/>
|
||||
<field name="mailing_type" invisible="1"/>
|
||||
<field name="mailing_model_id" string="Recipients" optional="hide"/>
|
||||
<field name="user_id" widget="many2one_avatar_user"/>
|
||||
<field name="campaign_id" string="Campaign" groups="mass_mailing.group_mass_mailing_campaign" optional="hide"/>
|
||||
<field name="ab_testing_enabled" string="A/B Test"
|
||||
groups="mass_mailing.group_mass_mailing_campaign"
|
||||
attrs="{'column_invisible': [('parent.ab_testing_mailings_sms_count', '=', 0)]}"/>
|
||||
<field name="sent" sum="Total Sent"/>
|
||||
<field name="clicked" string="Clicked (%)" avg="Average of Clicked"/>
|
||||
<field name="bounced" string="Bounced (%)" optional="hide" avg="Average of Bounced"/>
|
||||
<field name="state" decoration-info="state in ('draft', 'in_queue')" decoration-success="state in ('sending', 'done')" widget="badge"/>
|
||||
<button name="action_duplicate" type="object" string="Duplicate"/>
|
||||
</tree>
|
||||
</field>
|
||||
|
||||
Reference in New Issue
Block a user