[MERGE] modules.loading: extra loop when installing/upgrading modules to help solve missing deps
In some rare cases the dependencies have changed, and modules that newly depend on a module that is not installed cannot be loaded on the first pass. For technical reasons all installed/to upgrade/to remove modules have to be processed before starting to consider new installations, so this requires two passes. In trunk the inner loop inside `load_marked_modules()` will be dropped because it should be unnecessary. bzr revid: odo@openerp.com-20130909150859-k8xykkorgnmv0xx0
This commit is contained in:
@@ -337,13 +337,21 @@ def load_modules(db, force_demo=False, status=None, update_module=False):
|
||||
# they are part of the "currently installed" modules. They will
|
||||
# be dropped in STEP 6 later, before restarting the loading
|
||||
# process.
|
||||
states_to_load = ['installed', 'to upgrade', 'to remove']
|
||||
processed = load_marked_modules(cr, graph, states_to_load, force, status, report, loaded_modules, update_module)
|
||||
processed_modules.extend(processed)
|
||||
if update_module:
|
||||
states_to_load = ['to install']
|
||||
processed = load_marked_modules(cr, graph, states_to_load, force, status, report, loaded_modules, update_module)
|
||||
processed_modules.extend(processed)
|
||||
# IMPORTANT 2: We have to loop here until all relevant modules have been
|
||||
# processed, because in some rare cases the dependencies have
|
||||
# changed, and modules that depend on an uninstalled module
|
||||
# will not be processed on the first pass.
|
||||
# It's especially useful for migrations.
|
||||
previously_processed = -1
|
||||
while previously_processed < len(processed_modules):
|
||||
previously_processed = len(processed_modules)
|
||||
processed_modules += load_marked_modules(cr, graph,
|
||||
['installed', 'to upgrade', 'to remove'],
|
||||
force, status, report, loaded_modules, update_module)
|
||||
if update_module:
|
||||
processed_modules += load_marked_modules(cr, graph,
|
||||
['to install'], force, status, report,
|
||||
loaded_modules, update_module)
|
||||
|
||||
# load custom models
|
||||
cr.execute('select model from ir_model where state=%s', ('manual',))
|
||||
|
||||
Reference in New Issue
Block a user