summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorChristophe Simonis <christophe@tinyerp.com>2008-08-05 17:35:37 +0200
committerChristophe Simonis <christophe@tinyerp.com>2008-08-05 17:35:37 +0200
commite1a5ed51dbb9417b357db14eff8ca22400a2e10f (patch)
tree39fab271c3f02714594035d89996a5aee0906d7e /bin
parentbb7a3f37592751259d1017286e9cceffc052def1 (diff)
during addons initialisation, warn user if the objects doesn't specify access rules
bzr revid: christophe@tinyerp.com-20080805153537-dp98erjkz9zzuml6
Diffstat (limited to 'bin')
-rw-r--r--bin/addons/__init__.py18
1 files changed, 18 insertions, 0 deletions
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