summaryrefslogtreecommitdiff
path: root/addons/mass_mailing/wizard/mail_compose_message.py
diff options
context:
space:
mode:
authorYannick Tivisse <yti@odoo.com>2017-09-13 15:18:12 +0200
committerYannick Tivisse <yti@odoo.com>2017-09-15 15:56:23 +0200
commit51b5ee7c3c1bbc08c5aa284300fd95f63cbf7ad1 (patch)
tree20e8d4393155038da314b6071ec04bb43af60b74 /addons/mass_mailing/wizard/mail_compose_message.py
parente9fca14452273be1807d3b47f6220f563c343481 (diff)
[IMP] mass_mailing: choose model among all chatter models
This commit removes the strange selection box based on a magic flag and some strange methods returning a string. Instead just allow to send mass mailing on all models inheriting from mail.thread using the is mail thread flag. Various addons are updated to remove the _mail_mass_mailing class attribute used to determine mass mailing capability. We consider people could send a mass mailing on every model inheriting from mail.thread. It makes no sense to limit it to a given set of addons.
Diffstat (limited to 'addons/mass_mailing/wizard/mail_compose_message.py')
-rw-r--r--addons/mass_mailing/wizard/mail_compose_message.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/addons/mass_mailing/wizard/mail_compose_message.py b/addons/mass_mailing/wizard/mail_compose_message.py
index 6c1fc81280e..6147b028a18 100644
--- a/addons/mass_mailing/wizard/mail_compose_message.py
+++ b/addons/mass_mailing/wizard/mail_compose_message.py
@@ -23,7 +23,7 @@ class MailComposeMessage(models.TransientModel):
# use only for allowed models in mass mailing
if self.composition_mode == 'mass_mail' and \
(self.mass_mailing_name or self.mass_mailing_id) and \
- self.model in [item[0] for item in self.env['mail.mass_mailing']._get_mailing_model()]:
+ self.env['ir.model'].sudo().search([('model', '=', self.model), ('is_mail_thread', '=', True)], limit=1):
mass_mailing = self.mass_mailing_id
if not mass_mailing:
reply_to_mode = 'email' if self.no_auto_thread else 'thread'
@@ -37,7 +37,7 @@ class MailComposeMessage(models.TransientModel):
'reply_to': reply_to,
'sent_date': fields.Datetime.now(),
'body_html': self.body,
- 'mailing_model': self.model,
+ 'mailing_model_id': self.env['ir.model'].search([('model', '=', self.model)], limit=1).id,
'mailing_domain': self.active_domain,
})