summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorryv-odoo <ryv@odoo.com>2019-09-30 09:14:45 +0000
committerryv-odoo <ryv@odoo.com>2019-09-30 09:17:29 +0000
commiteebeefcf8bd65bdfc020667352d842b919b1a50a (patch)
tree6a65e75c91684a69f7c27399cacaf40d2ac26043
parentd43a63d5f632269be50ee58d244672336b34882d (diff)
[IMP] mass_mailing(_sms) : revamp/fix mail marketing views
- Revamp the kanban view of the mass mailing (and mass SMS) model to be more concise and readable. Also fix the issue of no border progress bar in community version (same view). - In the kanban view of mail marketing, when mailing list model is targerted, the count of record was not correct. Create a display condition if mailing list is used to fix the issue. TASK_ID : 2075733
-rw-r--r--addons/mass_mailing/models/mailing.py6
-rw-r--r--addons/mass_mailing/models/mailing_contact.py2
-rw-r--r--addons/mass_mailing/views/mailing_mailing_views.xml66
-rw-r--r--addons/mass_mailing_sms/views/mailing_mailing_views.xml4
4 files changed, 37 insertions, 41 deletions
diff --git a/addons/mass_mailing/models/mailing.py b/addons/mass_mailing/models/mailing.py
index d84237d1e9e..1da973c73dc 100644
--- a/addons/mass_mailing/models/mailing.py
+++ b/addons/mass_mailing/models/mailing.py
@@ -104,7 +104,6 @@ class MassMailing(models.Model):
help="Use a specific mail server in priority. Otherwise Odoo relies on the first outgoing mail server available (based on their sequencing) as it does for normal mails.")
contact_list_ids = fields.Many2many('mailing.list', 'mail_mass_mailing_list_rel',
string='Mailing Lists')
- contact_list_count = fields.Integer('# Contact List', compute='_compute_contact_list_count')
contact_ab_pc = fields.Integer(string='A/B Testing percentage',
help='Percentage of the contacts that will be mailed. Recipients will be taken randomly.', default=100)
unique_ab_testing = fields.Boolean(string='Allow A/B Testing', default=False,
@@ -130,11 +129,6 @@ class MassMailing(models.Model):
bounced_ratio = fields.Integer(compute="_compute_statistics", string='Bounced Ratio')
next_departure = fields.Datetime(compute="_compute_next_departure", string='Scheduled date')
- @api.depends('contact_list_ids')
- def _compute_contact_list_count(self):
- for mass_mailing in self:
- mass_mailing.contact_list_count = len(mass_mailing.contact_list_ids)
-
def _compute_total(self):
for mass_mailing in self:
mass_mailing.total = len(mass_mailing.sudo()._get_recipients())
diff --git a/addons/mass_mailing/models/mailing_contact.py b/addons/mass_mailing/models/mailing_contact.py
index ea25ce31936..95627f4260e 100644
--- a/addons/mass_mailing/models/mailing_contact.py
+++ b/addons/mass_mailing/models/mailing_contact.py
@@ -46,7 +46,7 @@ class MassMailingContact(models.Model):
base."""
_name = 'mailing.contact'
_inherit = ['mail.thread.blacklist']
- _description = 'Mass Mailing Contact'
+ _description = 'Mailing Contact'
_order = 'email'
name = fields.Char()
diff --git a/addons/mass_mailing/views/mailing_mailing_views.xml b/addons/mass_mailing/views/mailing_mailing_views.xml
index d06c64db04f..20aa910d783 100644
--- a/addons/mass_mailing/views/mailing_mailing_views.xml
+++ b/addons/mass_mailing/views/mailing_mailing_views.xml
@@ -262,7 +262,6 @@
<field name='total'/>
<field name='mailing_model_id'/>
<field name='mailing_model_name'/>
- <field name='contact_list_count'/>
<field name='sent_date'/>
<field name='active'/>
<templates>
@@ -286,7 +285,19 @@
<div class="oe_kanban_content">
<div class="o_kanban_record_top">
<div class="o_kanban_record_headings">
- <h3 class="mt4 mb4">
+ <div class="row" attrs="{'invisible': [('sent_date', '=', False)]}">
+ <h3 class="my-1 col-8 o_text_overflow">
+ <field name="subject"/>
+ </h3>
+ <div class="progress border col-3 px-0 mt-2" style="background-color: inherit; height:12px;">
+ <div class="progress-bar" role="progressbar"
+ aria-valuemin="0"
+ t-att-aria-valuenow="record.delivered.raw_value"
+ t-att-aria-valuemax="record.expected.raw_value"
+ t-attf-style="width: #{record.delivered.raw_value * 100 / record.expected.raw_value}%"/>
+ </div>
+ </div>
+ <h3 class="my-1 o_text_overflow" attrs="{'invisible': [('sent_date', '!=', False)]}">
<field name="subject"/>
</h3>
<field name="mailing_type" invisible="1"/>
@@ -298,44 +309,35 @@
</div>
</div>
<div class="o_kanban_record_body" t-if="!selection_mode" attrs="{'invisible': [('sent_date', '=', False)]}">
- <t t-if="record.sent_date">
- <div class="row" name="stat_opened">
- <div class="col-8">
- Opened
+ <div>
+ <b><field name="delivered"/> / <field name="expected"/></b> Delivered to
+ <field name='mailing_model_id' attrs="{'invisible': [('mailing_model_name','=','mailing.list')]}"/>
+ <span attrs="{'invisible': [('mailing_model_name','!=','mailing.list')]}">Mailing Contact</span>
</div>
- <div class="col-4 text-right">
- <field name="opened_ratio"/> %
+ <div class="d-flex justify-content-between">
+ <div name="stat_opened">
+ <b><field name="opened_ratio" />%</b> Opened
</div>
+ <div name="stat_replied">
+ <b><field name="replied_ratio" />%</b> Replied
</div>
- <div class="row" name="stat_replied">
- <div class="col-8">
- Replied
- </div>
- <div class="col-4 text-right">
- <field name="replied_ratio"/> %
- </div>
+ <div name="stat_clicks">
+ <b><field name="clicks_ratio" />%</b> Clicks
</div>
- <div class="row" name="stat_clicks">
- <div class="col-8">
- Clicks
- </div>
- <div class="col-4 text-right">
- <field name="clicks_ratio"/> %
- </div>
- </div>
- <div class='mt-1' name="stat_delivered">
- <field name="delivered" widget="progressbar" title="Delivered" options="{'current_value': 'delivered', 'max_value': 'expected', 'editable': false}"/>
- </div>
- </t>
</div>
</div>
- <div>
- <span class="fa fa-clock-o text-muted mr-2" attrs="{'invisible': [('sent_date', '=', False)]}"/><field name="sent_date"/>
- <img t-att-src="kanban_image('res.users', 'image_128', record.user_id.raw_value)" t-att-title="record.user_id.value" t-att-alt="record.user_id.value" class="o_image_24_cover oe_kanban_avatar float-right"/>
</div>
- <div name="div_total_model" class="oe_clear text-muted" style="display: inline;">
+ <div name="div_responsible_avatar">
+ <span attrs="{'invisible': [('sent_date', '=', False)]}">
+ <span class="fa fa-clock-o text-muted mr-2"/>
+ <field name="sent_date" widget="date"/>
+ </span>
+ <span attrs="{'invisible': [('sent_date', '!=', False)]}" class="oe_clear text-muted">
<field name='total'/>
- <field name='mailing_model_id'/><span attrs="{'invisible': [('mailing_model_name', '!=', 'mailing.list')]}"> Contacts</span>
+ <field name='mailing_model_id' attrs="{'invisible': [('mailing_model_name','=','mailing.list')]}"/>
+ <span attrs="{'invisible': [('mailing_model_name','!=','mailing.list')]}">Mailing Contact</span>
+ </span>
+ <img t-att-src="kanban_image('res.users', 'image_128', record.user_id.raw_value)" t-att-title="record.user_id.value" t-att-alt="record.user_id.value" class="o_image_24_cover oe_kanban_avatar float-right"/>
</div>
</div>
</t>
diff --git a/addons/mass_mailing_sms/views/mailing_mailing_views.xml b/addons/mass_mailing_sms/views/mailing_mailing_views.xml
index b0fb2c129b9..dedfd377b0b 100644
--- a/addons/mass_mailing_sms/views/mailing_mailing_views.xml
+++ b/addons/mass_mailing_sms/views/mailing_mailing_views.xml
@@ -159,8 +159,8 @@
<xpath expr="//div[@name='stat_replied']" position="attributes">
<attribute name="attrs">{'invisible': [('mailing_type', '!=', 'mail')]}</attribute>
</xpath>
- <xpath expr="//div[@name='div_total_model']" position="after">
- <div class="alert alert-warning" role="alert" attrs="{'invisible': [('sms_has_insufficient_credit', '=', False)]}">
+ <xpath expr="//div[@name='div_responsible_avatar']" position="after">
+ <div class="alert alert-warning mb-0 mt-3" role="alert" attrs="{'invisible': [('sms_has_insufficient_credit', '=', False)]}">
<a name="action_buy_sms_credits" type="object">Insufficient credits</a>
</div>
</xpath>