[IMP] mail: revamp the mail composer
On the CRM module, the user can send an email to all the contacts associated to the leads matching some criteria by (1) displaying the list view, (2) applying a search filter, (3) clicking on the "EMAIL" button and (4) checking a checkbox on the mail composer to ask the server to use the active search. To do the same thing, the user can (1) display the list view, (2) apply a search filter, (3) select all the records and (3) click on the "EMAIL" button. To avoid redundancy and improve the usability of the composer, we will remove the search domain passing from the mail composer. Note that it will still be possible to pass a search domain programmatically. To improve the guidance of the mail composer, we will add helper messages, update the labels and move the options in a dedicated pane. The wording of the buttons will also be updated dynamically based on the selected options. Example: When the user enters something in the `mass_mailing_name` field to create a new mass mailing campaign from the new message, the label of the "Send" button will be set to "Send Mass Mailing" which gives more indication on what will happen when the user clicks on it. task-2523036 Part-of: odoo/odoo#71413
This commit is contained in:
@@ -130,8 +130,8 @@ class MailComposer(models.TransientModel):
|
||||
string='Considers answers as new thread',
|
||||
help='Manage answers as new incoming emails instead of replies going to the same thread.')
|
||||
reply_to_mode = fields.Selection([
|
||||
('update', 'Log in the original discussion thread'),
|
||||
('new', 'Redirect to another email address')],
|
||||
('update', 'Store email and replies in the chatter of each record'),
|
||||
('new', 'Collect replies on a specific email address')],
|
||||
string='Replies', compute='_compute_reply_to_mode', inverse='_inverse_reply_to_mode',
|
||||
help="Original Discussion: Answers go in the original document discussion thread. \n Another Email Address: Answers go to the email address mentioned in the tracking message-id instead of original document discussion thread. \n This has an impact on the generated message-id.")
|
||||
is_log = fields.Boolean('Log an Internal Note',
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<field name="model">mail.compose.message</field>
|
||||
<field name="groups_id" eval="[Command.link(ref('base.group_user'))]"/>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Compose Email">
|
||||
<form string="Compose Email" class="pt-0 pb-0">
|
||||
<group>
|
||||
<!-- truly invisible fields for control and options -->
|
||||
<field name="composition_mode" invisible="1"/>
|
||||
@@ -15,66 +15,52 @@
|
||||
<field name="is_log" invisible="1"/>
|
||||
<field name="parent_id" invisible="1"/>
|
||||
<field name="mail_server_id" invisible="1"/>
|
||||
<field name="active_domain" invisible="1"/>
|
||||
|
||||
<!-- Various warnings -->
|
||||
<div colspan="2" class="oe_form_box_info bg-info oe_text_center"
|
||||
attrs="{'invisible': [('active_domain', '=', False)]}">
|
||||
<p attrs="{'invisible': [('use_active_domain', '=', False)]}">
|
||||
<strong>
|
||||
All records matching your current search filter will be mailed,
|
||||
not only the ids selected in the list view.
|
||||
</strong><br />
|
||||
The email will be sent for all the records selected in the list.<br />
|
||||
Confirming this wizard will probably take a few minutes blocking your browser.
|
||||
</p>
|
||||
<p attrs="{'invisible': [('use_active_domain', '=', True)]}">
|
||||
<strong>Only records checked in list view will be used.</strong><br />
|
||||
The email will be sent for all the records selected in the list.
|
||||
</p>
|
||||
<p class="mt8">
|
||||
<span attrs="{'invisible': [('use_active_domain', '=', True)]}">
|
||||
If you want to send it for all the records matching your search criterion, check this box :
|
||||
</span>
|
||||
<span attrs="{'invisible': [('use_active_domain', '=', False)]}">
|
||||
If you want to use only selected records please uncheck this selection box :
|
||||
</span>
|
||||
<field class="oe_inline" name="use_active_domain"/>
|
||||
</p>
|
||||
</div>
|
||||
<!-- visible wizard -->
|
||||
<field name="email_from"
|
||||
attrs="{'invisible':[('composition_mode', '!=', 'mass_mail')]}"/>
|
||||
<label for="partner_ids" string="Recipients" attrs="{'invisible': [('is_log', '=', True)]}" groups="base.group_user"/>
|
||||
<label for="partner_ids" string="Recipients" attrs="{'invisible': ['|', ('is_log', '=', True), ('composition_mode', '!=', 'comment')]}"/>
|
||||
<div groups="base.group_user" attrs="{'invisible': [('is_log', '=', True)]}">
|
||||
<span attrs="{'invisible': [('composition_mode', '!=', 'mass_mail')]}">
|
||||
<strong>Email mass mailing</strong> on
|
||||
<span attrs="{'invisible': [('use_active_domain', '=', True)]}">the selected records</span>
|
||||
<span attrs="{'invisible': [('use_active_domain', '=', False)]}">the current search filter</span>.
|
||||
</span>
|
||||
<span name="document_followers_text" attrs="{'invisible':['|', ('model', '=', False), ('composition_mode', '=', 'mass_mail')]}">Followers of the document and</span>
|
||||
<field name="partner_ids" widget="many2many_tags_email" placeholder="Add contacts to notify..."
|
||||
context="{'force_email':True, 'show_email':True}"
|
||||
attrs="{'invisible': [('composition_mode', '!=', 'comment')]}"/>
|
||||
</div>
|
||||
<field name="subject" placeholder="Subject..." required="True"/>
|
||||
<field name="subject" placeholder="Welcome to MyCompany!" required="True"/>
|
||||
<!-- mass post -->
|
||||
<field name="notify"
|
||||
attrs="{'invisible':[('composition_mode', '!=', 'mass_post')]}"/>
|
||||
<!-- mass mailing -->
|
||||
<field name="reply_to_force_new" invisible="1"/>
|
||||
<field name="reply_to_mode" attrs="{'invisible':[('composition_mode', '!=', 'mass_mail')]}" widget="radio"/>
|
||||
<field name="reply_to" placeholder="Email address to which replies will be redirected"
|
||||
attrs="{'invisible':['|', ('reply_to_mode', '=', 'update'), ('composition_mode', '!=', 'mass_mail')],
|
||||
'required':[('reply_to_mode', '!=', 'update'), ('composition_mode', '=', 'mass_mail')]}"/>
|
||||
</group>
|
||||
<field name="can_edit_body" invisible="1"/>
|
||||
<field name="body" options="{'style-inline': true}" attrs="{'readonly': [('can_edit_body', '=', False)]}" force_save="1"/>
|
||||
<group col="4">
|
||||
<field name="attachment_ids" widget="many2many_binary" string="Attach a file" nolabel="1" colspan="2"/>
|
||||
<field name="template_id" options="{'no_create': True}"
|
||||
context="{'default_model': model, 'default_body_html': body, 'default_subject': subject}"/>
|
||||
</group>
|
||||
<div attrs="{'invisible': [('composition_mode', '=', 'mass_mail')]}">
|
||||
<field name="body" placeholder="Write your message here..." options="{'style-inline': true}" attrs="{'readonly': [('can_edit_body', '=', False)]}" force_save="1"/>
|
||||
<group col="4">
|
||||
<field name="attachment_ids" widget="many2many_binary" string="Attach a file" nolabel="1" colspan="2"/>
|
||||
<field name="template_id" string="Load template" options="{'no_create': True}"
|
||||
context="{'default_model': model, 'default_body_html': body, 'default_subject': subject}"/>
|
||||
</group>
|
||||
</div>
|
||||
<notebook attrs="{'invisible': [('composition_mode', '!=', 'mass_mail')]}">
|
||||
<page string="Content">
|
||||
<div>
|
||||
<field name="body" placeholder="Write your message here..." options="{'style-inline': true}" attrs="{'readonly': [('can_edit_body', '=', False)]}" force_save="1"/>
|
||||
<group col="4">
|
||||
<field name="attachment_ids" widget="many2many_binary" string="Attach a file" nolabel="1" colspan="2"/>
|
||||
<field name="template_id" string="Load template" options="{'no_create': True}"
|
||||
context="{'default_model': model, 'default_body_html': body, 'default_subject': subject}"/>
|
||||
</group>
|
||||
</div>
|
||||
</page>
|
||||
<page string="Settings">
|
||||
<!-- mass mailing -->
|
||||
<field name="reply_to_force_new" invisible="1"/>
|
||||
<field name="reply_to_mode" attrs="{'invisible':[('composition_mode', '!=', 'mass_mail')]}" widget="radio"/>
|
||||
<group>
|
||||
<field name="reply_to" string="Reply-to Address" placeholder='e.g: "info@mycompany.odoo.com"'
|
||||
attrs="{'invisible':['|', ('reply_to_mode', '=', 'update'), ('composition_mode', '!=', 'mass_mail')],
|
||||
'required':[('reply_to_mode', '!=', 'update'), ('composition_mode', '=', 'mass_mail')]}"/>
|
||||
</group>
|
||||
</page>
|
||||
</notebook>
|
||||
<footer>
|
||||
<button string="Send" attrs="{'invisible': [('is_log', '=', True)]}" name="action_send_mail" type="object" class="btn-primary o_mail_send" data-hotkey="q"/>
|
||||
<button string="Log" attrs="{'invisible': [('is_log', '=', False)]}" name="action_send_mail" type="object" class="btn-primary" data-hotkey="q"/>
|
||||
|
||||
@@ -9,7 +9,7 @@ class MailComposeMessage(models.TransientModel):
|
||||
|
||||
mass_mailing_id = fields.Many2one('mailing.mailing', string='Mass Mailing', ondelete='cascade')
|
||||
campaign_id = fields.Many2one('utm.campaign', string='Mass Mailing Campaign')
|
||||
mass_mailing_name = fields.Char(string='Mass Mailing Name')
|
||||
mass_mailing_name = fields.Char(string='Mass Mailing Name', help='If set, a mass mailing will be created so that you can track its results in the Email Marketing app.')
|
||||
mailing_list_ids = fields.Many2many('mailing.list', string='Mailing List')
|
||||
|
||||
def get_mail_values(self, res_ids):
|
||||
|
||||
@@ -13,6 +13,34 @@
|
||||
<field name="mass_mailing_name"
|
||||
attrs="{'invisible': [('composition_mode', '!=', 'mass_mail')]}"/>
|
||||
</xpath>
|
||||
<xpath expr="//button[@name='action_send_mail'][not(hasclass('o_mail_send'))]" position="attributes">
|
||||
<!-- 'Log' button -->
|
||||
<attribute name="attrs">
|
||||
{'invisible': [
|
||||
'|',
|
||||
('is_log', '=', False),
|
||||
'&',
|
||||
('mass_mailing_name', '!=', ''),
|
||||
('mass_mailing_name', '!=', False)
|
||||
]}
|
||||
</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//button[hasclass('o_mail_send')]" position="attributes">
|
||||
<!-- 'Send' button -->
|
||||
<attribute name="attrs">
|
||||
{'invisible': [
|
||||
'|',
|
||||
('is_log', '=', True),
|
||||
'&',
|
||||
('mass_mailing_name', '!=', ''),
|
||||
('mass_mailing_name', '!=', False)
|
||||
]}
|
||||
</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//button[@name='action_send_mail']" position="after">
|
||||
<button string="Send Mass Mailing" name="action_send_mail" type="object" class="btn-primary o_mail_send"
|
||||
attrs="{'invisible': ['|', ('mass_mailing_name', '==', ''), ('mass_mailing_name', '==', False)]}" data-hotkey="q"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user