You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
1.0 KiB

  1. # -*- coding: utf-8 -*-
  2. # Copyright 2016 ACSONE SA/NV (<http://acsone.eu>)
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  4. from openerp import models, fields, api
  5. class MailComposeMessage(models.TransientModel):
  6. _inherit = 'mail.compose.message'
  7. @api.model
  8. def default_get(self, fields_list):
  9. res = super(MailComposeMessage, self).default_get(fields_list)
  10. res.setdefault(
  11. 'autofollow_recipients',
  12. self.env.context.get('mail_post_autofollow', False))
  13. return res
  14. autofollow_recipients = fields.Boolean(
  15. string='Make recipients followers',
  16. help="""if checked, the additional recipients will be added as\
  17. followers on the related object""")
  18. @api.multi
  19. def send_mail(self, auto_commit=False):
  20. for wizard in self:
  21. super(MailComposeMessage, wizard.with_context(
  22. mail_post_autofollow=wizard.autofollow_recipients)).send_mail(
  23. auto_commit=auto_commit)
  24. return True