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.

28 lines
1.0 KiB

  1. # -*- coding: utf-8 -*-
  2. # Copyright 2015 Therp BV <http://therp.nl>
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  4. from odoo import api, models
  5. class MailMessage(models.Model):
  6. _inherit = 'mail.message'
  7. @api.multi
  8. def _notify(
  9. self, force_send=False, send_after_commit=True, user_signature=True,
  10. ):
  11. """notify author if she's a follower and turned on force_own"""
  12. self.ensure_one()
  13. if self.subtype_id and self.model and self.res_id and self.env[
  14. 'mail.followers'
  15. ].search([
  16. ('res_model', '=', self.model),
  17. ('res_id', '=', self.res_id),
  18. ('partner_id', '=', self.author_id.id),
  19. ('force_own_subtype_ids', '=', self.subtype_id.id),
  20. ]):
  21. self = self.with_context(mail_notify_author=True)
  22. return super(MailMessage, self)._notify(
  23. force_send=force_send, send_after_commit=send_after_commit,
  24. user_signature=user_signature,
  25. )