Files
odoo_source/addons/mass_mailing/wizard/mail_compose_message_views.xml
T
Renaud Thiry eaf905d55a [IMP] mass_mailing: hide mailing option on invalid
Currently when creating a composer in mass mode
the composer always shows the 'mass mailing name' option
even when a mailing cannot be created.

This silently creates a regular mass mail.

This hides that option when selecting records of models
that do not inherit from thread. So that users do not falsly
believe a mailing will be created.

task #2990447

closes odoo/odoo#102105

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-10-06 14:56:49 +02:00

49 lines
2.6 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Add mass mail campaign to the mail.compose.message form view -->
<record model="ir.ui.view" id="email_compose_form_mass_mailing">
<field name="name">mail.compose.message.form.mass_mailing</field>
<field name="model">mail.compose.message</field>
<field name="inherit_id" ref="mail.email_compose_message_wizard_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='notify']" position="after">
<field name="model_is_thread" invisible="1"/>
<field name="campaign_id" groups="mass_mailing.group_mass_mailing_campaign"
attrs="{'invisible': ['|', ('composition_mode', '!=', 'mass_mail'), ('model_is_thread', '!=', True)]}"/>
<field name="mass_mailing_name"
attrs="{'invisible': ['|', ('composition_mode', '!=', 'mass_mail'), ('model_is_thread', '!=', True)]}"/>
</xpath>
<xpath expr="//button[@name='action_send_mail'][not(hasclass('o_mail_send'))]" position="attributes">
<!-- 'Log' button -->
<attribute name="attrs">
{'invisible': [
'|',
('is_log', '=', False),
'&amp;',
('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),
'&amp;',
('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>
</odoo>