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

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