From e1a5ed51dbb9417b357db14eff8ca22400a2e10f Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Tue, 5 Aug 2008 17:35:37 +0200 Subject: [PATCH] during addons initialisation, warn user if the objects doesn't specify access rules bzr revid: christophe@tinyerp.com-20080805153537-dp98erjkz9zzuml6 --- bin/addons/__init__.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/bin/addons/__init__.py b/bin/addons/__init__.py index 2bad1c22886..156688c322a 100644 --- a/bin/addons/__init__.py +++ b/bin/addons/__init__.py @@ -270,6 +270,24 @@ def load_module_graph(cr, graph, status=None, **kwargs): cr.execute('update ir_module_module set demo=%s where name=%s', (True, package.name)) package_todo.append(package.name) cr.execute("update ir_module_module set state='installed' where state in ('to upgrade', 'to install') and name=%s", (package.name,)) + + # check if all model of the module have at least a access rule. + cr.execute(""" SELECT name + FROM ir_model m + WHERE EXISTS (SELECT 1 + FROM ir_model_data + WHERE module = %s + AND model = m.name + ) + AND NOT EXISTS (SELECT 1 + FROM ir_model_access + WHERE model_id = m.id + ) + """, (m,)) + + for (model,) in cr.fetchall(): + logger.notifyChannel('init', netsvc.LOG_WARNING, 'addon:%s:object %s has no access rules!' % (m,model,)) + cr.commit() statusi+=1