[REM] mail: remove mass post option from mail composer
RATIONALE Improve usage of composer in comment or email mode: support batch-posting in comment, support more configuration from templates, improve global model. SPECIFICATIONS Remove deprecated "mass_post" option from composer. It is either a comment (using message_post) either a mass mail (creating emails). Mass post was anyway nor used nor really supported. It will be replaced by supporting having a comment on several IDs (batch comment mode, posting a message on several records instead of being limited to one as currently). This cleaning also allows to remove the 'notify' field that was an option used for mass_post. All this should be supported through subtypes and correct choice of post / mass mailing. Task-3035101 (Mail: Support batch-posting from composer) Part-of: odoo/odoo#99482
This commit is contained in:
@@ -116,10 +116,10 @@ class MailComposer(models.TransientModel):
|
||||
'res.partner', 'Author',
|
||||
help="Author of the message. If not set, email_from may hold an email address that did not match any partner.")
|
||||
# composition
|
||||
composition_mode = fields.Selection(selection=[
|
||||
('comment', 'Post on a document'),
|
||||
('mass_mail', 'Email Mass Mailing'),
|
||||
('mass_post', 'Post on Multiple Documents')], string='Composition mode', default='comment')
|
||||
composition_mode = fields.Selection(
|
||||
selection=[('comment', 'Post on a document'),
|
||||
('mass_mail', 'Email Mass Mailing')],
|
||||
string='Composition mode', default='comment')
|
||||
model = fields.Char('Related Document Model')
|
||||
res_id = fields.Integer('Related Document ID')
|
||||
record_name = fields.Char('Message Record Name')
|
||||
@@ -136,7 +136,6 @@ class MailComposer(models.TransientModel):
|
||||
subtype_id = fields.Many2one(
|
||||
'mail.message.subtype', 'Subtype', ondelete='set null',
|
||||
default=lambda self: self.env['ir.model.data']._xmlid_to_res_id('mail.mt_comment'))
|
||||
notify = fields.Boolean('Notify followers', help='Notify followers of the document (mass post only)')
|
||||
mail_activity_type_id = fields.Many2one('mail.activity.type', 'Mail Activity Type', ondelete='set null')
|
||||
# destination
|
||||
reply_to = fields.Char('Reply To', help='Reply email address. Setting the reply_to bypasses the automatic thread creation.')
|
||||
@@ -358,7 +357,7 @@ class MailComposer(models.TransientModel):
|
||||
|
||||
for wizard in self:
|
||||
# Mass Mailing
|
||||
mass_mode = wizard.composition_mode in ('mass_mail', 'mass_post')
|
||||
mass_mode = wizard.composition_mode == 'mass_mail'
|
||||
|
||||
# wizard works in batch mode: [res_id] or active_ids or active_domain
|
||||
if mass_mode and wizard.use_active_domain and wizard.model:
|
||||
@@ -387,7 +386,7 @@ class MailComposer(models.TransientModel):
|
||||
self.ensure_one()
|
||||
post_values_all = self._prepare_mail_values(res_ids)
|
||||
ActiveModel = self.env[self.model] if self.model and hasattr(self.env[self.model], 'message_post') else self.env['mail.thread']
|
||||
if self.composition_mode == 'mass_post':
|
||||
if len(res_ids) > 1:
|
||||
# do not send emails directly but use the queue instead
|
||||
# add context key to avoid subscribing the author
|
||||
ActiveModel = ActiveModel.with_context(
|
||||
@@ -546,7 +545,7 @@ class MailComposer(models.TransientModel):
|
||||
|
||||
if email_mode:
|
||||
subtype_id = False
|
||||
elif self.is_log or (self.composition_mode == 'mass_post' and not self.notify): # log a note: subtype is False
|
||||
elif self.is_log: # log a note: subtype is False
|
||||
subtype_id = False
|
||||
elif self.subtype_id:
|
||||
subtype_id = self.subtype_id.id
|
||||
|
||||
@@ -33,9 +33,6 @@
|
||||
context="{'force_email':True, 'show_email':True}"/>
|
||||
</div>
|
||||
<field name="subject" placeholder="Welcome to MyCompany!" required="True"/>
|
||||
<!-- mass post -->
|
||||
<field name="notify"
|
||||
attrs="{'invisible':[('composition_mode', '!=', 'mass_post')]}"/>
|
||||
</group>
|
||||
<field name="can_edit_body" invisible="1"/>
|
||||
<div attrs="{'invisible': [('composition_mode', '=', 'mass_mail')]}">
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<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">
|
||||
<xpath expr="//field[@name='auto_delete_message']" 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)]}"/>
|
||||
|
||||
Reference in New Issue
Block a user