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.

25 lines
1.1 KiB

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