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.

79 lines
2.7 KiB

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