← Back to team overview

credativ team mailing list archive

[Merge] lp:~therp-nl/openupgrade-server/7.0-fix_forced_deps into lp:openupgrade-server

 

Stefan Rijnhart (Therp) has proposed merging lp:~therp-nl/openupgrade-server/7.0-fix_forced_deps into lp:openupgrade-server.

Requested reviews:
  OpenUpgrade Committers (openupgrade-committers)

For more details, see:
https://code.launchpad.net/~therp-nl/openupgrade-server/7.0-fix_forced_deps/+merge/176709
-- 
https://code.launchpad.net/~therp-nl/openupgrade-server/7.0-fix_forced_deps/+merge/176709
Your team OpenUpgrade Committers is requested to review the proposed merge of lp:~therp-nl/openupgrade-server/7.0-fix_forced_deps into lp:openupgrade-server.
=== modified file 'openerp/openupgrade/openupgrade_loading.py'
--- openerp/openupgrade/openupgrade_loading.py	2012-11-24 22:38:22 +0000
+++ openerp/openupgrade/openupgrade_loading.py	2013-07-24 15:29:32 +0000
@@ -20,9 +20,11 @@
 ##############################################################################
 
 import types
+from openerp import release
 from openerp.osv.orm import TransientModel
 from openerp.osv import fields
 from openerp.openupgrade.openupgrade import table_exists
+from openerp.tools import config, safe_eval
 
 # A collection of functions used in 
 # openerp/modules/loading.py
@@ -33,6 +35,9 @@
     so that we can inject them into the graph at upgrade
     time. Used in the modified OpenUpgrade Server,
     not to be used in migration scripts
+
+    Also take the custom configuration directive 'forced_deps'
+    into account.
     """
     if not module_list:
         return module_list
@@ -46,7 +51,17 @@
             AND ir_module_module.name in %s
         """, (tuple(module_list),))
     dependencies = [x[0] for x in cr.fetchall()]
-    return list(set(module_list + dependencies))
+
+    forced_deps = config.get_misc('openupgrade', 'force_deps', '{}')
+    forced_deps = config.get_misc(
+        'openupgrade', 'force_deps_' + release.version, forced_deps)
+    forced_deps = safe_eval.safe_eval(forced_deps)
+
+    result = []
+    for module in module_list + dependencies:
+        result.append(module)
+        result += forced_deps.get(module, [])
+    return list(set(result))
 
 def log_model(model, local_registry):
     """


Follow ups