mirror of
https://github.com/bringout/oca-ocb-core.git
synced 2026-04-21 16:52:07 +02:00
19.0 vanilla
This commit is contained in:
parent
0a7ae8db93
commit
991d2234ca
416 changed files with 646602 additions and 300844 deletions
41
odoo-bringout-oca-ocb-base/odoo/init.py
Normal file
41
odoo-bringout-oca-ocb-base/odoo/init.py
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
# ruff: noqa: E402, F401
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
""" Odoo initialization. """
|
||||
|
||||
import gc
|
||||
import sys
|
||||
from .release import MIN_PY_VERSION
|
||||
assert sys.version_info > MIN_PY_VERSION, f"Outdated python version detected, Odoo requires Python >= {'.'.join(map(str, MIN_PY_VERSION))} to run."
|
||||
|
||||
# ----------------------------------------------------------
|
||||
# Set gc thresolds if they are default, see `odoo.tools.gc`.
|
||||
# ----------------------------------------------------------
|
||||
if gc.get_threshold()[0] == 700:
|
||||
# Handling requests can sometimes allocate over 5k new objects, let leave
|
||||
# some space before starting any collection.
|
||||
gc.set_threshold(12_000, 20, 25)
|
||||
|
||||
# ----------------------------------------------------------
|
||||
# Import tools to patch code and libraries
|
||||
# required to do as early as possible for evented and timezone
|
||||
# ----------------------------------------------------------
|
||||
from . import _monkeypatches
|
||||
_monkeypatches.patch_init()
|
||||
|
||||
from .tools.gc import gc_set_timing
|
||||
gc_set_timing(enable=True)
|
||||
|
||||
# ----------------------------------------------------------
|
||||
# Shortcuts
|
||||
# Expose them at the `odoo` namespace level
|
||||
# ----------------------------------------------------------
|
||||
import odoo
|
||||
from .orm.commands import Command
|
||||
from .orm.utils import SUPERUSER_ID
|
||||
from .tools.translate import _, _lt
|
||||
|
||||
odoo.SUPERUSER_ID = SUPERUSER_ID
|
||||
odoo._ = _
|
||||
odoo._lt = _lt
|
||||
odoo.Command = Command
|
||||
Loading…
Add table
Add a link
Reference in a new issue