Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .oca/oca-port/blacklist/extendable.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"pull_requests": {
"orphaned_commits": "(auto) Nothing to port from PR #",
"OCA/rest-framework#313": "Already ported",
"OCA/rest-framework#348": "(auto) Nothing to port from PR #348"
}
}
20 changes: 19 additions & 1 deletion extendable/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from odoo.modules.registry import Registry
from odoo.tests import common

from extendable import context
from extendable import context, main


def _get_addon_name(full_name: str) -> str:
Expand Down Expand Up @@ -54,6 +54,24 @@ def init_extendable_registry(cls):
extendable_registry.init_registry([f"odoo.addons.{current_addon}.*"])
cls.token = context.extendable_registry.set(cls._extendable_registry)

@classmethod
def backup_extendable_registry(cls):
# Store the current extendable classes
cls._initial_extendable_class_defs_by_module = (
main._extendable_class_defs_by_module
)
# Use a copy of the current extendable classes
main._extendable_class_defs_by_module = dict(
cls._initial_extendable_class_defs_by_module
)

@classmethod
def restore_extendable_registry(cls):
# Restore the initial extendable classes
main._extendable_class_defs_by_module = (
cls._initial_extendable_class_defs_by_module
)

@classmethod
def reset_extendable_registry(cls):
context.extendable_registry.reset(cls.token)