import os
import re
import sys
+import threading
import zipfile
import zipimport
cr.commit()
if not tools.config.options['test_disable']:
try:
+ threading.currentThread().testing = True
_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:
+ threading.currentThread().testing = False
if tools.config.options['test_commit']:
cr.commit()
else:
migrations = openerp.modules.migration.MigrationManager(cr, graph)
logger.debug('loading %d packages...', len(graph))
+ # get db timestamp
+ cr.execute("select now()::timestamp")
+ dt_before_load = cr.fetchone()[0]
+
# register, instantiate and initialize models for each modules
for index, package in enumerate(graph):
module_name = package.name
cr.commit()
+ # mark new res_log records as read
+ cr.execute("update res_log set read=True where create_date >= %s", (dt_before_load,))
+
cr.commit()
return loaded_modules, processed_modules
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)
- if isinstance(model_obj, osv.osv.osv_memory) and not isinstance(model_obj, osv.osv.osv):
- 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():
if obj:
obj._check_removed_columns(cr, log=True)
else:
- 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)
# Cleanup orphan records
pool.get('ir.model.data')._process_end(cr, 1, processed_modules)