[FIX] db: module auto-install should work recursively during db bootstrap too
bzr revid: odo@openerp.com-20120808165904-hyyxn3djm75od67b
This commit is contained in:
parent
f5e7d53bce
commit
256eae55b4
|
@ -68,10 +68,7 @@ def initialize(cr):
|
|||
category_id = create_categories(cr, categories)
|
||||
|
||||
if info['installable']:
|
||||
if info['auto_install'] and not info['depends']:
|
||||
state = 'to install'
|
||||
else:
|
||||
state = 'uninstalled'
|
||||
state = 'uninstalled'
|
||||
else:
|
||||
state = 'uninstallable'
|
||||
|
||||
|
@ -95,7 +92,19 @@ def initialize(cr):
|
|||
for d in dependencies:
|
||||
cr.execute('INSERT INTO ir_module_module_dependency \
|
||||
(module_id,name) VALUES (%s, %s)', (id, d))
|
||||
cr.commit()
|
||||
|
||||
# Install recursively all auto-installing modules
|
||||
while True:
|
||||
cr.execute("""SELECT m.name FROM ir_module_module m WHERE m.auto_install AND state != 'to install'
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM ir_module_module_dependency d JOIN ir_module_module mdep ON (d.name = mdep.name)
|
||||
WHERE d.module_id = m.id AND mdep.state != 'to install'
|
||||
)""")
|
||||
to_auto_install = [x[0] for x in cr.fetchall()]
|
||||
if not to_auto_install: break
|
||||
cr.execute("""UPDATE ir_module_module SET state='to install' WHERE name in %s""", (tuple(to_auto_install),))
|
||||
|
||||
cr.commit()
|
||||
|
||||
def create_categories(cr, categories):
|
||||
""" Create the ir_module_category entries for some categories.
|
||||
|
|
Loading…
Reference in New Issue