BASE: fix case integer

bzr revid: ced-e0652bc8be23732971ca40adab2cc2a58f88d09c
This commit is contained in:
ced 2007-05-29 11:05:57 +00:00
parent c10ef23528
commit a462c4badf
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 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,))
cr.execute('select max(CASE WHEN perm_'+mode+' THEN 1 else 0 END) 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 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,))
cr.execute('select max(CASE WHEN perm_'+mode+' THEN 1 else 0 END) 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