Skip to content

Commit

Permalink
[REF] core: move building model methods to a separate file
Browse files Browse the repository at this point in the history
Simply adapt registry.setup_models() to its new name for saas-18.2.

odoo/odoo#193559
odoo/enterprise#77278

closes #207

Signed-off-by: Christophe Simonis (chs) <[email protected]>
  • Loading branch information
rco-odoo authored and aj-fuentes committed Feb 6, 2025
1 parent 9757242 commit 596b3b1
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/util/orm.py
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,10 @@ def _add_magic_fields(self):

with all_patches():
# 4. Reload the registry with the models and fields converted to manual.
env.registry.setup_models(env.cr)
setup_models = (
env.registry._setup_models__ if hasattr(env.registry, "_setup_models__") else env.registry.setup_models
)
setup_models(env.cr)

# 5. Do the operation.
yield
Expand Down Expand Up @@ -759,4 +762,7 @@ def _add_magic_fields(self):

# 7. Reload the registry as before
env.clear()
env.registry.setup_models(env.cr)
setup_models = (
env.registry._setup_models__ if hasattr(env.registry, "_setup_models__") else env.registry.setup_models
)
setup_models(env.cr)

0 comments on commit 596b3b1

Please sign in to comment.