parent
64927adea0
commit
aa4bca4cf8
|
@ -54,6 +54,3 @@ class ir_default(osv.osv):
|
|||
}
|
||||
ir_default()
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
|
@ -280,9 +280,6 @@ class ir_model_access(osv.osv):
|
|||
|
||||
def check_group(self, cr, uid, model, mode, group_id):
|
||||
""" Check if a specific group has the access mode to the specified model"""
|
||||
if uid==1:
|
||||
return True
|
||||
|
||||
assert mode in ['read','write','create','unlink'], 'Invalid access mode'
|
||||
|
||||
if isinstance(model, browse_record):
|
||||
|
@ -290,13 +287,14 @@ class ir_model_access(osv.osv):
|
|||
model_name = model.name
|
||||
else:
|
||||
model_name = model
|
||||
|
||||
|
||||
cr.execute("SELECT perm_" + mode + " "
|
||||
" FROM ir_model_access a "
|
||||
" JOIN ir_model m ON (m.id = a.model_id) "
|
||||
" WHERE m.model = %s AND a.group_id = %d", (model_name, group_id)
|
||||
)
|
||||
return bool(cr.fetchone()[0])
|
||||
r = cr.fetchone()
|
||||
return bool(r and r[0])
|
||||
|
||||
def check(self, cr, uid, model, mode='read', raise_exception=True):
|
||||
if uid==1:
|
||||
|
|
|
@ -507,7 +507,10 @@ form: module.record_id""" % (xml_id,)
|
|||
if a_type=='act_window':
|
||||
a_id = self.id_get(cr, 'ir.actions.%s'% a_type, a_action)
|
||||
cr.execute('select view_type,view_mode,name,view_id,target from ir_act_window where id=%d', (int(a_id),))
|
||||
action_type,action_mode,action_name,view_id,target = cr.fetchone()
|
||||
rrres = cr.fetchone()
|
||||
assert rrres, "No window action defined for this id %s !\n" \
|
||||
"Verify that this is a window action or add a type argument." % (a_action,)
|
||||
action_type,action_mode,action_name,view_id,target = rrres
|
||||
if view_id:
|
||||
cr.execute('SELECT type FROM ir_ui_view WHERE id=%d', (int(view_id),))
|
||||
action_mode, = cr.fetchone()
|
||||
|
|
Loading…
Reference in New Issue