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.

39 lines
1.2 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. from .. import exceptions as ex
  7. class CompanyCase(TransactionCase):
  8. model = "res.partner"
  9. context = {"default_is_company": True}
  10. def test_computing_after_unlink(self):
  11. """Test what happens if recomputed after unlinking.
  12. This test might seem useless, but really this happens when module
  13. ``partner_relations`` is installed.
  14. See https://github.com/OCA/partner-contact/issues/154.
  15. """
  16. data = {"name": u"Söme name"}
  17. record = self.env[self.model].with_context(**self.context).create(data)
  18. record.unlink()
  19. record.recompute()
  20. class PersonCase(CompanyCase):
  21. context = {"default_is_company": False}
  22. class UserCase(CompanyCase, MailInstalled):
  23. model = "res.users"
  24. context = {"default_login": "user@example.com"}
  25. def test_computing_after_unlink(self):
  26. # Cannot create users if ``mail`` is installed
  27. if not self.mail_installed():
  28. super(UserCase, self).test_computing_after_unlink()