Anto has proposed merging
lp:~openerp-dev/openobject-addons/trunk-bug-1033505-abo into
lp:openobject-addons.
Requested reviews:
OpenERP Core Team (openerp)
Related bugs:
Bug #1033505 in OpenERP Addons: "AccessError when select parent project"
https://bugs.launchpad.net/openobject-addons/+bug/1033505
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-1033505-abo/+merge/130993
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-1033505-abo/+merge/130993
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/trunk-bug-1033505-abo.
=== modified file 'analytic/analytic.py'
--- analytic/analytic.py 2012-10-05 14:36:06 +0000
+++ analytic/analytic.py 2012-10-23 12:50:21 +0000
@@ -255,27 +255,27 @@
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)
- if not account:
+ account_ids = self.search(cr, uid, [('code', '=', name)] + args, limit=limit, context=context)
+ if not account_ids:
names=map(lambda i : i.strip(),name.split('/'))
for i in range(len(names)):
dom=[('name', operator, names[i])]
if i>0:
- dom+=[('id','child_of',account)]
- account = self.search(cr, uid, dom, limit=limit, context=context)
- newacc = account
+ dom+=[('id','child_of',account_ids)]
+ account_ids = self.search(cr, uid, dom, limit=limit, context=context)
+ newacc = account_ids
while newacc:
newacc = self.search(cr, uid, [('parent_id', 'in', newacc)], limit=limit, context=context)
- account += newacc
+ account_ids += newacc
if args:
- account = self.search(cr, uid, [('id', 'in', account)] + args, limit=limit, context=context)
+ account_ids = self.search(cr, uid, [('id', 'in', account_ids)] + args, limit=limit, context=context)
else:
- account = self.search(cr, uid, args, limit=limit, context=context)
- return self.name_get(cr, uid, account, context=context)
+ account_ids = self.search(cr, uid, args, limit=limit, context=context)
+ return self.name_get(cr, uid, account_ids, context=context)
def create(self, cr, uid, vals, context=None):
contract = super(account_analytic_account, self).create(cr, uid, vals, context=context)
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp