[FIX] only fetch the analytic accounts that the current user has the right to read, avoiding an access error when calling name_get()

lp bug: https://launchpad.net/bugs/1033505 fixed

bzr revid: abo@openerp.com-20121023121501-gl0wfhdo9zp34wx2
This commit is contained in:
Antonin Bourguignon 2012-10-23 14:15:01 +02:00
parent a53941b165
commit 910bb4d24e
1 changed files with 2 additions and 2 deletions

View File

@ -255,8 +255,8 @@ class account_analytic_account(osv.osv):
if context is None:
context={}
if context.get('current_model') == 'project.project':
cr.execute("select analytic_account_id from project_project")
project_ids = [x[0] for x in cr.fetchall()]
project_obj = self.pool.get("account.analytic.account")
project_ids = project_obj.search(cr, uid, args)
return self.name_get(cr, uid, project_ids, context=context)
if name:
account = self.search(cr, uid, [('code', '=', name)] + args, limit=limit, context=context)