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
717 B

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