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.

24 lines
682 B

  1. from odoo.addons.galicea_environment_checkup import (
  2. custom_check,
  3. CheckWarning,
  4. CheckSuccess,
  5. CheckFail,
  6. )
  7. from odoo import http
  8. @custom_check
  9. def check_single_db(env):
  10. if not http.request:
  11. raise CheckWarning("Could not detect DB settings.")
  12. dbs = http.db_list(True, http.request.httprequest)
  13. if len(dbs) == 1:
  14. return CheckSuccess("Odoo runs in a single-DB mode.")
  15. details = (
  16. "<p>Odoo runs in a multi-DB mode, which will cause API request routing to fail.</p>"
  17. "<p>Run Odoo with <tt>--dbfilter</tt> or <tt>--database</tt> flag.</p>"
  18. )
  19. return CheckFail("Odoo runs in a multi-DB mode.", details=details)