check on ir_model_access : light modification for compatibility with postgres 7.4 (bool_or)

bzr revid: bch-399843c66a198ee23e11d7b8e9f006b75d4a8964
This commit is contained in:
bch 2007-05-29 05:57:22 +00:00
parent bb16eb3924
commit 8579038ac7
1 changed files with 2 additions and 2 deletions

View File

@ -90,10 +90,10 @@ class ir_model_access(osv.osv):
assert mode in ['read','write','create','unlink'], 'Invalid access mode for security'
if uid==1:
return True
cr.execute('select bool_or(perm_'+mode+') from ir_model_access a join ir_model m on (a.model_id=m.id) join res_groups_users_rel gu on (gu.gid = a.group_id) where m.model= %s and gu.uid= %s',(model_name,uid,))
cr.execute('select max(perm_'+mode+'::integer) from ir_model_access a join ir_model m on (a.model_id=m.id) join res_groups_users_rel gu on (gu.gid = a.group_id) where m.model= %s and gu.uid= %s',(model_name,uid,))
r= cr.fetchall()
if r[0][0] == None:
cr.execute(' select bool_or(perm_'+mode+') from ir_model_access a join ir_model m on (a.model_id=m.id) where a.group_id is null and m.model=%s',(model_name,))
cr.execute('select max(perm_'+mode+'::integer) from ir_model_access a join ir_model m on (a.model_id=m.id) where a.group_id is null and m.model=%s',(model_name,))
r= cr.fetchall()
if r[0][0] == None : return True