[IMP] mass_mailing: improve the mailing list Kanban view
Purpose ======= This commit rework the design of the Kanban view of the mailing list. There are now 2 styles for this Kanban view - Grouped, for this one we keep the same "card design" as before - Ungrouped, we use a "list style" view, and the card take the all width of the screen Add some actions to be able to import quickly contacts from this view or to send a mailing to the mailing contact list. Task-2737782 closes odoo/odoo#86587 Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import _, fields, models
|
||||
from odoo import _, Command, fields, models
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
@@ -126,6 +126,36 @@ class MassMailingList(models.Model):
|
||||
# ACTIONS
|
||||
# ------------------------------------------------------
|
||||
|
||||
def action_open_import(self):
|
||||
"""Open the mailing list contact import wizard."""
|
||||
action = self.env['ir.actions.actions']._for_xml_id('mass_mailing.mailing_contact_import_action')
|
||||
action['context'] = {
|
||||
**self.env.context,
|
||||
'default_mailing_list_ids': self.ids,
|
||||
'default_subscription_list_ids': [
|
||||
Command.create({'list_id': mailing_list.id})
|
||||
for mailing_list in self
|
||||
],
|
||||
}
|
||||
return action
|
||||
|
||||
def action_send_mailing(self):
|
||||
"""Open the mailing form view, with the current lists set as recipients."""
|
||||
view = self.env.ref('mass_mailing.mailing_mailing_view_form_full_width')
|
||||
action = self.env["ir.actions.actions"]._for_xml_id('mass_mailing.mailing_mailing_action_mail')
|
||||
|
||||
action.update({
|
||||
'context': {
|
||||
**self.env.context,
|
||||
'default_contact_list_ids': self.ids,
|
||||
},
|
||||
'target': 'current',
|
||||
'view_type': 'form',
|
||||
'views': [(view.id, 'form')],
|
||||
})
|
||||
|
||||
return action
|
||||
|
||||
def action_view_contacts(self):
|
||||
action = self.env["ir.actions.actions"]._for_xml_id("mass_mailing.action_view_mass_mailing_contacts")
|
||||
action['domain'] = [('list_ids', 'in', self.ids)]
|
||||
|
||||
@@ -108,6 +108,55 @@
|
||||
.o_kanban_record {
|
||||
width: 350px;
|
||||
}
|
||||
&.o_kanban_ungrouped {
|
||||
padding: 0;
|
||||
.o_mailing_list_kanban_grouped {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
&.o_kanban_grouped .o_mailing_list_kanban_ungrouped {
|
||||
display: none !important;
|
||||
}
|
||||
.o_mailing_list_kanban_ungrouped {
|
||||
.o_mailing_list_kanban_stats > div {
|
||||
min-width: 70px;
|
||||
}
|
||||
.o_mailing_list_kanban_stats > a {
|
||||
flex-wrap: wrap;
|
||||
&:hover {
|
||||
font-weight: normal;
|
||||
}
|
||||
@include media-breakpoint-down(xs) {
|
||||
font-size: 1.4rem;
|
||||
height: 40px;
|
||||
margin-bottom: 30px;
|
||||
min-width: 90px;
|
||||
width: 30%;
|
||||
}
|
||||
}
|
||||
.o_mailing_list_kanban_button {
|
||||
background: transparent;
|
||||
border-width: 0;
|
||||
outline: 0;
|
||||
padding: 0;
|
||||
font-weight: 300;
|
||||
&:hover {
|
||||
font-weight: normal;
|
||||
}
|
||||
&.o_mailing_list_kanban_big_nb {
|
||||
text-align: left;
|
||||
font-size: 300%;
|
||||
@include media-breakpoint-up(sm) {
|
||||
text-align: right;
|
||||
}
|
||||
}
|
||||
}
|
||||
.text-large {
|
||||
line-height: 1.1em;
|
||||
font-size: 120%;
|
||||
font-weight: 300;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -141,7 +141,8 @@
|
||||
<field name="active"/>
|
||||
<templates>
|
||||
<t t-name="kanban-box">
|
||||
<div class="oe_kanban_global_click">
|
||||
<!-- Card when the Kanban view is grouped -->
|
||||
<div class="oe_kanban_global_click o_mailing_list_kanban_grouped">
|
||||
<div class="oe_kanban_content d-flex flex-column h-100">
|
||||
<h2 class="mb-3 o_text_overflow">
|
||||
<field name="name"/>
|
||||
@@ -192,6 +193,88 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Card when the Kanban view is not grouped -->
|
||||
<div class="oe_kanban_global_click o_mailing_list_kanban_ungrouped w-100 m-0 d-flex flex-row justify-content-between align-items-center flex-wrap">
|
||||
<div class="col-lg-3 col-sm-6 col-12 py-0 my-auto">
|
||||
<div class="d-flex text-large">
|
||||
<span class="d-inline-block text-truncate font-weight-normal text-large"
|
||||
t-att-title="record.name.value">
|
||||
<field name="name"/>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="o_mailing_list_kanban_counts col-lg-1 col-12 my-auto d-flex">
|
||||
<div class="d-flex flex-row justify-content-start justify-content-md-end">
|
||||
<div class="my-auto p-0">
|
||||
<button name="action_view_contacts" type="object"
|
||||
class="o_mailing_list_kanban_button o_mailing_list_kanban_big_nb text-primary font-weight-bold">
|
||||
<field name="contact_count"/>
|
||||
</button>
|
||||
</div>
|
||||
<div class="my-auto px-0">
|
||||
<button name="action_view_contacts" type="object"
|
||||
class="o_mailing_list_kanban_button text-large text-left ml-2">
|
||||
Total <br/>Contacts
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="o_mailing_list_kanban_stats col-lg-5 col-sm-12 col-12 py-0 my-3 my-sm-auto d-flex justify-content-sm-between justify-content-start flex-wrap">
|
||||
<a class="mr-sm-0 mr-3 text-large" tabindex="-1"
|
||||
name="action_view_contacts_email" type="object">
|
||||
<span class="font-weight-normal">
|
||||
<field name="contact_count_email"/>
|
||||
</span>
|
||||
<br/>
|
||||
<span class="text-secondary">
|
||||
<i class="fa fa-envelope-o"/> Contacts
|
||||
</span>
|
||||
</a>
|
||||
<a class="mr-sm-0 mr-3 text-large" tabindex="-1"
|
||||
name="action_view_mailings" type="object">
|
||||
<span class="font-weight-normal">
|
||||
<field name="mailing_count"/>
|
||||
</span>
|
||||
<br/>
|
||||
<span class="text-secondary">Mailings</span>
|
||||
</a>
|
||||
<hr class="w-100 d-block d-sm-none opacity-0 m-0 p-0"/>
|
||||
<a class="mr-sm-0 mr-3 text-large" tabindex="-1"
|
||||
name="action_view_contacts_bouncing" type="object">
|
||||
<span class="font-weight-normal">
|
||||
<field name="contact_pct_bounce"/> %
|
||||
</span>
|
||||
<br/>
|
||||
<span class="text-secondary">Bounce</span>
|
||||
</a>
|
||||
<a class="mr-sm-0 mr-3 text-large" tabindex="-1"
|
||||
name="action_view_contacts_opt_out" type="object">
|
||||
<span class="font-weight-normal">
|
||||
<field name="contact_pct_opt_out"/> %
|
||||
</span>
|
||||
<br/>
|
||||
<span class="text-secondary">Opt-Out</span>
|
||||
</a>
|
||||
<a class="mr-sm-0 mr-3 text-large" tabindex="-1"
|
||||
name="action_view_contacts_blacklisted" type="object">
|
||||
<span class="font-weight-normal">
|
||||
<field name="contact_pct_blacklisted"/> %
|
||||
</span>
|
||||
<br/>
|
||||
<span class="text-secondary">Blacklist</span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="o_kanban_ungrouped_action_buttons col-12 col-lg-2 py-0 pr-2 pl-md-2 my-md-auto my-2 d-none d-md-flex flex-wrap justify-content-lg-end">
|
||||
<button name="action_open_import" string="Import Contacts"
|
||||
type="object" class="btn btn-secondary border mr-2 text-nowrap">
|
||||
Import Contacts
|
||||
</button>
|
||||
<button name="action_send_mailing" string="Send Mailing"
|
||||
type="object" class="btn btn-secondary border mr-2 text-nowrap">
|
||||
Send Mailing
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
</templates>
|
||||
</kanban>
|
||||
|
||||
@@ -14,6 +14,18 @@
|
||||
<span t-esc="record.contact_count_sms.value" class="ml-3"/>
|
||||
</a>
|
||||
</xpath>
|
||||
<xpath expr="//div[hasclass('o_mailing_list_kanban_stats')]//a" position="after">
|
||||
<a class="mr-sm-0 mr-3 text-large" tabindex="-1"
|
||||
name="action_view_contacts_sms" type="object">
|
||||
<span class="font-weight-normal">
|
||||
<field name="contact_count_sms"/>
|
||||
</span>
|
||||
<br/>
|
||||
<span class="text-secondary">
|
||||
<i class="fa fa-phone"/> Contacts
|
||||
</span>
|
||||
</a>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user