Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFR] Standalone openupgrade_records #1

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
1 change: 0 additions & 1 deletion openupgrade_framework/odoo_patch/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
from . import odoo
from . import addons

3 changes: 0 additions & 3 deletions openupgrade_framework/odoo_patch/addons/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
from . import mrp
from . import stock
from . import point_of_sale
20 changes: 0 additions & 20 deletions openupgrade_framework/odoo_patch/addons/mrp/__init__.py

This file was deleted.

This file was deleted.

This file was deleted.

17 changes: 0 additions & 17 deletions openupgrade_framework/odoo_patch/addons/stock/__init__.py

This file was deleted.

5 changes: 0 additions & 5 deletions openupgrade_framework/odoo_patch/odoo/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
from . import modules
from . import service
from . import tools

# Nothing todo the function, the function check_security didn't changed
from . import http

# adapted to V14
# TODO, OpenUpgrade maintainers : check if it's OK
from . import models
179 changes: 0 additions & 179 deletions openupgrade_framework/odoo_patch/odoo/models.py

This file was deleted.

39 changes: 5 additions & 34 deletions openupgrade_framework/odoo_patch/odoo/modules/loading.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@


def _load_module_graph(cr, graph, status=None, perform_checks=True,
skip_modules=None, report=None, models_to_check=None, upg_registry=None):
# <OpenUpgrade:CHANGED-SIGNATURE/>
skip_modules=None, report=None, models_to_check=None):
"""Migrates+Updates or Installs all module nodes from ``graph``
:param graph: graph of module nodes to load
:param status: deprecated parameter, unused, left to avoid changing signature in 8.0
Expand Down Expand Up @@ -111,17 +110,6 @@ def _load_module_graph(cr, graph, status=None, perform_checks=True,
models_updated |= set(model_names)
models_to_check -= set(model_names)
registry.setup_models(cr)
# <OpenUpgrade:ADD>
# rebuild the local registry based on the loaded models
local_registry = {}
env = api.Environment(cr, SUPERUSER_ID, {})
for model in env.values():
if not model._auto:
continue
openupgrade_loading.log_model(model, local_registry)
openupgrade_loading.compare_registries(
cr, package.name, upg_registry, local_registry)
# </OpenUpgrade>

registry.init_models(cr, model_names, {'module': package.name}, new_install)
elif package.state != 'to remove':
Expand Down Expand Up @@ -276,8 +264,7 @@ def _load_module_graph(cr, graph, status=None, perform_checks=True,


def _load_marked_modules(cr, graph, states, force, progressdict, report,
loaded_modules, perform_checks, models_to_check=None, upg_registry=None):
# <OpenUpgrade:CHANGED-SIGNATURE/>
loaded_modules, perform_checks, models_to_check=None):
"""Loads modules marked with ``states``, adding them to ``graph`` and
``loaded_modules`` and returns a list of installed/upgraded modules."""

Expand All @@ -295,14 +282,10 @@ def _load_marked_modules(cr, graph, states, force, progressdict, report,
break
graph.add_modules(cr, module_list, force)
_logger.debug('Updating graph with %d more modules', len(module_list))
# <OpenUpgrade:CHANGE>
# add upg_registry
loaded, processed = _load_module_graph(
cr, graph, progressdict, report=report, skip_modules=loaded_modules,
perform_checks=perform_checks, models_to_check=models_to_check,
upg_registry=upg_registry,
)
# </OpenUpgrade>
processed_modules.extend(processed)
loaded_modules.extend(loaded)
if not processed:
Expand All @@ -317,10 +300,6 @@ def _load_modules(db, force_demo=False, status=None, update_module=False):
if force_demo:
force.append('demo')

# <OpenUpgrade:ADD>
upg_registry = {}
# </OpenUpgrade>

models_to_check = set()

with db.cursor() as cr:
Expand Down Expand Up @@ -352,11 +331,9 @@ def _load_modules(db, force_demo=False, status=None, update_module=False):
# processed_modules: for cleanup step after install
# loaded_modules: to avoid double loading
report = registry._assertion_report
# <OpenUpgrade:CHANGE>
# add upg_registry
loaded_modules, processed_modules = _load_module_graph(
cr, graph, status, perform_checks=update_module,
report=report, models_to_check=models_to_check, upg_registry=upg_registry)
report=report, models_to_check=models_to_check)

# </OpenUpgrade>
load_lang = tools.config.pop('load_language')
Expand Down Expand Up @@ -423,19 +400,13 @@ def _load_modules(db, force_demo=False, status=None, update_module=False):
previously_processed = -1
while previously_processed < len(processed_modules):
previously_processed = len(processed_modules)
# <OpenUpgrade:CHANGE>
# add upg_registry
processed_modules += _load_marked_modules(cr, graph,
['installed', 'to upgrade', 'to remove'],
force, status, report, loaded_modules, update_module, models_to_check, upg_registry)
# </OpenUpgrade>
force, status, report, loaded_modules, update_module, models_to_check)
if update_module:
# <OpenUpgrade:CHANGE>
# add upg_registry
processed_modules += _load_marked_modules(cr, graph,
['to install'], force, status, report,
loaded_modules, update_module, models_to_check, upg_registry)
# </OpenUpgrade>
loaded_modules, update_module, models_to_check)
# check that new module dependencies have been properly installed after a migration/upgrade
cr.execute("SELECT name from ir_module_module WHERE state IN ('to install', 'to upgrade')")
module_list = [name for (name,) in cr.fetchall()]
Expand Down
2 changes: 0 additions & 2 deletions openupgrade_framework/odoo_patch/odoo/tools/__init__.py

This file was deleted.

23 changes: 0 additions & 23 deletions openupgrade_framework/odoo_patch/odoo/tools/convert.py

This file was deleted.

Loading