Raphael Collet (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-server/trunk-autoinstall-rco into 
lp:openobject-server.

Requested reviews:
  OpenERP Core Team (openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-server/trunk-autoinstall-rco/+merge/139213

Change the condition that triggers the installation of an auto-install module:
 - it must be 'uninstalled'
 - all its dependencies must be in 'installed', 'to install', or 'to upgrade'
 - *** at least one dependency must be 'to install' ***


-- 
https://code.launchpad.net/~openerp-dev/openobject-server/trunk-autoinstall-rco/+merge/139213
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-server/trunk-autoinstall-rco.
=== modified file 'openerp/addons/base/module/module.py'
--- openerp/addons/base/module/module.py	2012-12-08 18:11:51 +0000
+++ openerp/addons/base/module/module.py	2012-12-11 14:44:21 +0000
@@ -370,16 +370,20 @@
         # Mark the given modules to be installed.
         self.state_update(cr, uid, ids, 'to install', ['uninstalled'], context)
 
-        # Mark (recursively) the newly satisfied modules to also be installed:
+        # Mark (recursively) the newly satisfied modules to also be installed
 
         # Select all auto-installable (but not yet installed) modules.
-        domain = [('state', '=', 'uninstalled'), ('auto_install', '=', True),]
+        domain = [('state', '=', 'uninstalled'), ('auto_install', '=', True)]
         uninstalled_ids = self.search(cr, uid, domain, context=context)
         uninstalled_modules = self.browse(cr, uid, uninstalled_ids, context=context)
 
-        # Keep those with all their dependencies satisfied.
+        # Keep those with:
+        #  - all dependencies satisfied (installed or to be installed),
+        #  - at least one dependency being 'to install'
+        satisfied_states = frozenset(('installed', 'to install', 'to upgrade'))
         def all_depencies_satisfied(m):
-            return all(x.state in ('to install', 'installed', 'to upgrade') for x in m.dependencies_id)
+            states = set(d.state for d in m.dependencies_id)
+            return (states <= satisfied_states) and ('to install' in states)
         to_install_modules = filter(all_depencies_satisfied, uninstalled_modules)
         to_install_ids = map(lambda m: m.id, to_install_modules)
 

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : openerp-dev-gtk@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to