[FIX] ir.attachment: cleaner check for record existence in access rights

bzr revid: odo@openerp.com-20110909155025-cyhnmy89e9a0ijzt
This commit is contained in:
Olivier Dony 2011-09-09 17:50:25 +02:00
parent 2f47cf8558
commit 0f6510edfc
1 changed files with 1 additions and 2 deletions

View File

@ -50,8 +50,7 @@ class ir_attachment(osv.osv):
for model, mids in res_ids.items():
# ignore attachments that are not attached to a resource anymore when checking access rights
# (resource was deleted but attachment was not)
cr.execute('select id from '+self.pool.get(model)._table+' where id in %s', (tuple(mids),))
mids = [x[0] for x in cr.fetchall()]
mids = self.pool.get(model).exists(cr, uid, mids)
ima.check(cr, uid, model, mode)
self.pool.get(model).check_access_rule(cr, uid, mids, mode, context=context)