OCA reporting engine fork for dev and update.
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.

34 lines
1000 B

  1. # Copyright 2017 LasLabs Inc.
  2. # Copyright 2018 ACSONE
  3. # Copyright 2018 Camptocamp
  4. # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
  5. from odoo import models
  6. def setup_test_model(env, model_cls):
  7. """Pass a test model class and initialize it.
  8. Courtesy of SBidoul from https://github.com/OCA/mis-builder :)
  9. """
  10. model_cls._build_model(env.registry, env.cr)
  11. env.registry.setup_models(env.cr)
  12. env.registry.init_models(
  13. env.cr, [model_cls._name], dict(env.context, update_custom_fields=True)
  14. )
  15. def teardown_test_model(env, model_cls):
  16. """Pass a test model class and deinitialize it.
  17. Courtesy of SBidoul from https://github.com/OCA/mis-builder :)
  18. """
  19. if not getattr(model_cls, "_teardown_no_delete", False):
  20. del env.registry.models[model_cls._name]
  21. env.registry.setup_models(env.cr)
  22. class ResUsers(models.Model):
  23. _name = "res.users"
  24. _inherit = ["res.users", "comment.template"]
  25. _teardown_no_delete = True