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.

88 lines
2.1 KiB

  1. About
  2. =====
  3. This add-on allows you to:
  4. - programmatically check software dependencies required by your add-on, as well as inform the Administrator as to how to meet them,
  5. - add custom verification for Odoo instance set-up and inform the Administrator about any inconsistencies.
  6. Dependency checks
  7. =================
  8. .. image:: /galicea_environment_checkup/static/description/dependencies.png
  9. How-to
  10. ------
  11. Just add ``environment_checkup`` entry to ``__manifest__.py``
  12. .. code::
  13. {
  14. ...
  15. 'environment_checkup': {
  16. 'dependencies': {
  17. 'python': [
  18. {
  19. 'name': 'Crypto',
  20. 'version': '>=2.6.2',
  21. 'install': "pip install 'PyCrypto>=2.6.1'"
  22. },
  23. ],
  24. 'external': [
  25. {
  26. 'name': 'wkhtmltopdf',
  27. 'install': "apt install wkhtmltopdf"
  28. },
  29. {
  30. 'name': 'git',
  31. 'version': '^3.0.0',
  32. 'install': "apt install git"
  33. }
  34. ],
  35. 'internal': [
  36. {
  37. 'name': 'web',
  38. 'version': '~10.0.1.0'
  39. }
  40. ]
  41. }
  42. }
  43. }
  44. Custom in-code checks
  45. =====================
  46. .. image:: /galicea_environment_checkup/static/description/custom.png
  47. How-to
  48. ------
  49. 1. Add the check
  50. ``system_checks.py``
  51. .. code::
  52. # -*- coding: utf-8 -*-
  53. import cgi
  54. from odoo.addons.galicea_environment_checkup import custom_check, CheckSuccess, CheckWarning, CheckFail
  55. @custom_check
  56. def check_mail(env):
  57. users_without_emails = env['res.users'].sudo().search([('email', '=', False)])
  58. if users_without_emails:
  59. raise CheckWarning(
  60. 'Some users don\'t have their e-mails set up.',
  61. details='See user <tt>{}</tt>.'.format(cgi.escape(users_without_emails[0].name))
  62. )
  63. return CheckSuccess('All users have their e-mails set.')
  64. 2. Make sure it's loaded
  65. ``__init__.py``
  66. .. code::
  67. # -*- coding: utf-8 -*-
  68. from . import system_checks