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.

38 lines
1.1 KiB

  1. # -*- coding: utf-8 -*-
  2. # © 2015 Grupo ESOC
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  4. from openerp.tests.common import TransactionCase
  5. from .base import MailInstalled
  6. class CompanyCase(TransactionCase):
  7. model = "res.partner"
  8. context = {"default_is_company": True}
  9. def test_computing_after_unlink(self):
  10. """Test what happens if recomputed after unlinking.
  11. This test might seem useless, but really this happens when module
  12. ``partner_relations`` is installed.
  13. See https://github.com/OCA/partner-contact/issues/154.
  14. """
  15. data = {"name": u"Söme name"}
  16. record = self.env[self.model].with_context(**self.context).create(data)
  17. record.unlink()
  18. record.recompute()
  19. class PersonCase(CompanyCase):
  20. context = {"default_is_company": False}
  21. class UserCase(CompanyCase, MailInstalled):
  22. model = "res.users"
  23. context = {"default_login": "user@example.com"}
  24. def test_computing_after_unlink(self):
  25. # Cannot create users if ``mail`` is installed
  26. if not self.mail_installed():
  27. super(UserCase, self).test_computing_after_unlink()