mirror of
https://github.com/bringout/oca-technical.git
synced 2026-04-18 22:52:06 +02:00
Initial commit: OCA Technical packages (595 packages)
This commit is contained in:
commit
2cc02aac6e
24950 changed files with 2318079 additions and 0 deletions
|
|
@ -0,0 +1,30 @@
|
|||
# Copyright 2022 ACSONE SA/NV
|
||||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html)
|
||||
|
||||
from contextlib import contextmanager
|
||||
|
||||
from odoo import models
|
||||
from odoo.http import request
|
||||
|
||||
from extendable import context
|
||||
|
||||
from ..registry import _extendable_registries_database
|
||||
|
||||
|
||||
class IrHttp(models.AbstractModel):
|
||||
_inherit = "ir.http"
|
||||
|
||||
@classmethod
|
||||
def _dispatch(cls, endpoint):
|
||||
with cls._extendable_context_registry():
|
||||
return super()._dispatch(endpoint)
|
||||
|
||||
@classmethod
|
||||
@contextmanager
|
||||
def _extendable_context_registry(cls):
|
||||
registry = _extendable_registries_database.get(request.env.cr.dbname, {})
|
||||
token = context.extendable_registry.set(registry)
|
||||
try:
|
||||
yield
|
||||
finally:
|
||||
context.extendable_registry.reset(token)
|
||||
Loading…
Add table
Add a link
Reference in a new issue