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.

30 lines
1.1 KiB

  1. # -*- coding: utf-8 -*-
  2. # Copyright 2015 Pedro M. Baeza <pedro.baeza@tecnativa.com>
  3. # Copyright 2015 Antonio Espinosa <antonio.espinosa@tecnativa.com>
  4. # Copyright 2015 Javier Iniesta <javieria@antiun.com>
  5. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  6. from . import base
  7. class MailMailStatisticsCase(base.BaseCase):
  8. def test_link_partner(self):
  9. partner = self.create_partner(
  10. {'name': 'Test partner'})
  11. stat = self.env['mail.mail.statistics'].create({
  12. 'model': 'res.partner',
  13. 'res_id': partner.id,
  14. })
  15. self.assertEqual(partner.id, stat.partner_id.id)
  16. def test_link_mail_contact(self):
  17. partner = self.create_partner(
  18. {'name': 'Test partner', 'email': 'test@domain.com'})
  19. contact = self.create_mailing_contact(
  20. {'partner_id': partner.id, 'list_id': self.mailing_list.id})
  21. stat = self.env['mail.mail.statistics'].create({
  22. 'model': 'mail.mass_mailing.contact',
  23. 'res_id': contact.id,
  24. })
  25. self.assertEqual(partner.id, stat.partner_id.id)