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.

29 lines
1015 B

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