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.

20 lines
729 B

  1. # -*- coding: utf-8 -*-
  2. # Copyright 2016 Antonio Espinosa <antonio.espinosa@tecnativa.com>
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  4. from openerp import models, api
  5. from .mail_mass_mailing import event_filtered_ids
  6. class MailMassMailingContact(models.Model):
  7. _inherit = 'mail.mass_mailing.contact'
  8. @api.model
  9. def search_count(self, domain):
  10. res = super(MailMassMailingContact, self).search_count(domain)
  11. mass_mailing_id = self.env.context.get('exclude_mass_mailing', False)
  12. if mass_mailing_id:
  13. res_ids = event_filtered_ids(
  14. self, mass_mailing_id, domain, field='email')
  15. return len(res_ids) if res_ids else 0
  16. return res