_load_data(cr, module_name, idref, mode, 'test')
except Exception, e:
logging.getLogger('init.test').exception(
'Tests failed to execute in module %s', module_name)
finally:
_load_data(cr, module_name, idref, mode, 'test')
except Exception, e:
logging.getLogger('init.test').exception(
'Tests failed to execute in module %s', module_name)
finally:
migrations = openerp.modules.migration.MigrationManager(cr, graph)
logger.debug('loading %d packages...', len(graph))
migrations = openerp.modules.migration.MigrationManager(cr, graph)
logger.debug('loading %d packages...', len(graph))
# register, instantiate and initialize models for each modules
for index, package in enumerate(graph):
module_name = package.name
# register, instantiate and initialize models for each modules
for index, package in enumerate(graph):
module_name = package.name
register_module_classes(package.name)
models = pool.load(cr, package)
loaded_modules.append(package.name)
register_module_classes(package.name)
models = pool.load(cr, package)
loaded_modules.append(package.name)
init_module_models(cr, package.name, models)
status['progress'] = float(index) / len(graph)
init_module_models(cr, package.name, models)
status['progress'] = float(index) / len(graph)
if package.state=='to upgrade':
# upgrading the module information
modobj.write(cr, 1, [module_id], modobj.get_values_from_terp(package.data))
load_init_xml(module_name, idref, mode)
load_update_xml(module_name, idref, mode)
load_data(module_name, idref, mode)
if package.state=='to upgrade':
# upgrading the module information
modobj.write(cr, 1, [module_id], modobj.get_values_from_terp(package.data))
load_init_xml(module_name, idref, mode)
load_update_xml(module_name, idref, mode)
load_data(module_name, idref, mode)
status['progress'] = (index + 0.75) / len(graph)
load_demo_xml(module_name, idref, mode)
load_demo(module_name, idref, mode)
status['progress'] = (index + 0.75) / len(graph)
load_demo_xml(module_name, idref, mode)
load_demo(module_name, idref, mode)
modobj.update_translations(cr, 1, [module_id], None)
package.state = 'installed'
modobj.update_translations(cr, 1, [module_id], None)
package.state = 'installed'
if not openerp.modules.db.is_initialized(cr):
logger.notifyChannel("init", netsvc.LOG_INFO, "init db")
openerp.modules.db.initialize(cr)
if not openerp.modules.db.is_initialized(cr):
logger.notifyChannel("init", netsvc.LOG_INFO, "init db")
openerp.modules.db.initialize(cr)
# This is a brand new pool, just created in pooler.get_db_and_pool()
pool = pooler.get_pool(cr.dbname)
# This is a brand new pool, just created in pooler.get_db_and_pool()
pool = pooler.get_pool(cr.dbname)
# STEP 1: LOAD BASE (must be done before module dependencies can be computed for later steps)
graph = openerp.modules.graph.Graph()
# STEP 1: LOAD BASE (must be done before module dependencies can be computed for later steps)
graph = openerp.modules.graph.Graph()
if not graph:
logger.notifyChannel('init', netsvc.LOG_CRITICAL, 'module base cannot be loaded! (hint: verify addons-path)')
raise osv.osv.except_osv(_('Could not load base module'), _('module base cannot be loaded! (hint: verify addons-path)'))
# processed_modules: for cleanup step after install
# loaded_modules: to avoid double loading
if not graph:
logger.notifyChannel('init', netsvc.LOG_CRITICAL, 'module base cannot be loaded! (hint: verify addons-path)')
raise osv.osv.except_osv(_('Could not load base module'), _('module base cannot be loaded! (hint: verify addons-path)'))
# processed_modules: for cleanup step after install
# loaded_modules: to avoid double loading
- loaded_modules, processed_modules = load_module_graph(cr, graph, status, perform_checks=(not update_module), report=report)
+ # After load_module_graph(), 'base' has been installed or updated and its state is 'installed'.
+ loaded_modules, processed_modules = load_module_graph(cr, graph, status, report=report)
if tools.config['load_language']:
for lang in tools.config['load_language'].split(','):
tools.load_language(cr, lang)
# STEP 2: Mark other modules to be loaded/updated
if tools.config['load_language']:
for lang in tools.config['load_language'].split(','):
tools.load_language(cr, lang)
# STEP 2: Mark other modules to be loaded/updated
logger.notifyChannel('init', netsvc.LOG_INFO, 'updating modules list')
modobj.update_list(cr, 1)
logger.notifyChannel('init', netsvc.LOG_INFO, 'updating modules list')
modobj.update_list(cr, 1)
- _check_module_names(cr, itertools.chain(tools.config['init'].keys(), tools.config['update'].keys()))
+ if 'all' in tools.config['init']:
+ ids = modobj.search(cr, 1, [])
+ tools.config['init'] = dict.fromkeys([m['name'] for m in modobj.read(cr, 1, ids, ['name'])], 1)
- mods = [k for k in tools.config['init'] if tools.config['init'][k]]
- if mods:
- ids = modobj.search(cr, 1, ['&', ('state', '=', 'uninstalled'), ('name', 'in', mods)])
- if ids:
- modobj.button_install(cr, 1, ids)
+ _check_module_names(cr, itertools.chain(tools.config['init'].keys(), tools.config['update'].keys()))
- mods = [k for k in tools.config['update'] if tools.config['update'][k]]
- if mods:
- ids = modobj.search(cr, 1, ['&', ('state', '=', 'installed'), ('name', 'in', mods)])
- if ids:
- modobj.button_upgrade(cr, 1, ids)
+ mods = [k for k in tools.config['init'] if tools.config['init'][k] and k not in ('base', 'all')]
+ ids = modobj.search(cr, 1, ['&', ('state', '=', 'uninstalled'), ('name', 'in', mods)])
+ if ids:
+ modobj.button_install(cr, 1, ids) # goes from 'uninstalled' to 'to install'
- cr.execute("update ir_module_module set state=%s where name=%s", ('installed', 'base'))
+ mods = [k for k in tools.config['update'] if tools.config['update'][k] and k not in ('base', 'all')]
+ ids = modobj.search(cr, 1, ['&', ('state', '=', 'installed'), ('name', 'in', mods)])
+ if ids:
+ modobj.button_upgrade(cr, 1, ids) # goes from 'installed' to 'to upgrade'
# STEP 3: Load marked modules (skipping base which was done in STEP 1)
# IMPORTANT: this is done in two parts, first loading all installed or
# STEP 3: Load marked modules (skipping base which was done in STEP 1)
# IMPORTANT: this is done in two parts, first loading all installed or
cr.execute("""select model,name from ir_model where id NOT IN (select distinct model_id from ir_model_access)""")
for (model, name) in cr.fetchall():
model_obj = pool.get(model)
cr.execute("""select model,name from ir_model where id NOT IN (select distinct model_id from ir_model_access)""")
for (model, name) in cr.fetchall():
model_obj = pool.get(model)
- if model_obj and not isinstance(model_obj, osv.osv.osv_memory):
- logger.notifyChannel('init', netsvc.LOG_WARNING, 'object %s (%s) has no access rules!' % (model, name))
+ if model_obj and not model_obj.is_transient():
+ logger.notifyChannel('init', netsvc.LOG_WARNING, 'Model %s (%s) has no access rules!' % (model, name))
# Temporary warning while we remove access rights on osv_memory objects, as they have
# been replaced by owner-only access rights
cr.execute("""select distinct mod.model, mod.name from ir_model_access acc, ir_model mod where acc.model_id = mod.id""")
for (model, name) in cr.fetchall():
model_obj = pool.get(model)
# Temporary warning while we remove access rights on osv_memory objects, as they have
# been replaced by owner-only access rights
cr.execute("""select distinct mod.model, mod.name from ir_model_access acc, ir_model mod where acc.model_id = mod.id""")
for (model, name) in cr.fetchall():
model_obj = pool.get(model)
- if isinstance(model_obj, osv.osv.osv_memory):
- logger.notifyChannel('init', netsvc.LOG_WARNING, 'In-memory object %s (%s) should not have explicit access rules!' % (model, name))
+ if model_obj and model_obj.is_transient():
+ logger.notifyChannel('init', netsvc.LOG_WARNING, 'The transient model %s (%s) should not have explicit access rules!' % (model, name))
cr.execute("SELECT model from ir_model")
for (model,) in cr.fetchall():
cr.execute("SELECT model from ir_model")
for (model,) in cr.fetchall():
- logger.notifyChannel('init', netsvc.LOG_WARNING, "Model %s is referenced but not present in the orm pool!" % model)
+ logger.notifyChannel('init', netsvc.LOG_WARNING, "Model %s is declared but cannot be loaded! (Perhaps a module was partially removed or renamed)" % model)