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.

24 lines
815 B

  1. # Copyright (C) 2018 Creu Blanca
  2. # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
  3. from odoo import api, models
  4. from odoo.tools.safe_eval import safe_eval
  5. class MailFollowers(models.Model):
  6. _inherit = 'mail.followers'
  7. @api.model
  8. def _add_follower_command(self, res_model, res_ids, partner_data,
  9. channel_data, force=True):
  10. domain = self.env[
  11. 'mail.wizard.invite'
  12. ]._mail_restrict_follower_selection_get_domain()
  13. partners = self.env['res.partner'].search(
  14. [('id', 'in', list(partner_data))] +
  15. safe_eval(domain)
  16. )
  17. return super()._add_follower_command(
  18. res_model, res_ids,
  19. {p.id: partner_data[p.id] for p in partners},
  20. channel_data, force=force)