gooderp18绿色标准版
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.

81 lines
2.6KB

  1. # -*- coding: utf-8 -*-
  2. # ruff: noqa: E402, F401
  3. # Part of Odoo. See LICENSE file for full copyright and licensing details.
  4. """ OpenERP core library."""
  5. # ----------------------------------------------------------
  6. # odoo must be a namespace package for odoo.addons to become one too
  7. # https://packaging.python.org/guides/packaging-namespace-packages/
  8. # ----------------------------------------------------------
  9. import pkgutil
  10. import os.path
  11. __path__ = [
  12. os.path.abspath(path)
  13. for path in pkgutil.extend_path(__path__, __name__)
  14. ]
  15. import sys
  16. MIN_PY_VERSION = (3, 10)
  17. MAX_PY_VERSION = (3, 12)
  18. assert sys.version_info > MIN_PY_VERSION, f"Outdated python version detected, Odoo requires Python >= {'.'.join(map(str, MIN_PY_VERSION))} to run."
  19. # ----------------------------------------------------------
  20. # Shortcuts
  21. # ----------------------------------------------------------
  22. # The hard-coded super-user id (a.k.a. administrator, or root user).
  23. SUPERUSER_ID = 1
  24. def registry(database_name=None):
  25. """
  26. Return the model registry for the given database, or the database mentioned
  27. on the current thread. If the registry does not exist yet, it is created on
  28. the fly.
  29. """
  30. import warnings # noqa: PLC0415
  31. warnings.warn("Use directly odoo.modules.registry.Registry", DeprecationWarning, 2)
  32. if database_name is None:
  33. import threading
  34. database_name = threading.current_thread().dbname
  35. return modules.registry.Registry(database_name)
  36. # ----------------------------------------------------------
  37. # Import tools to patch code and libraries
  38. # required to do as early as possible for evented and timezone
  39. # ----------------------------------------------------------
  40. from . import _monkeypatches
  41. _monkeypatches.patch_all()
  42. # ----------------------------------------------------------
  43. # Imports
  44. # ----------------------------------------------------------
  45. from . import upgrade # this namespace must be imported first
  46. from . import addons
  47. from . import conf
  48. from . import loglevels
  49. from . import modules
  50. from . import netsvc
  51. from . import osv
  52. from . import release
  53. from . import service
  54. from . import sql_db
  55. from . import tools
  56. # ----------------------------------------------------------
  57. # Model classes, fields, api decorators, and translations
  58. # ----------------------------------------------------------
  59. from . import models
  60. from . import fields
  61. from . import api
  62. from odoo.tools.translate import _, _lt
  63. from odoo.fields import Command
  64. # ----------------------------------------------------------
  65. # Other imports, which may require stuff from above
  66. # ----------------------------------------------------------
  67. from . import cli
  68. from . import http
上海开阖软件有限公司 沪ICP备12045867号-1