Merge lp:~openerp-dev/openobject-addons/trunk-bug-1033505-abo into lp:openobject-addons

Proposed by Anto
Status: Merged
Approved by: Anto
Approved revision: no longer in the source branch.
Merged at revision: 7837
Proposed branch: lp:~openerp-dev/openobject-addons/trunk-bug-1033505-abo
Merge into: lp:openobject-addons
Diff against target: 42 lines (+11/-11)
1 file modified
analytic/analytic.py (+11/-11)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/trunk-bug-1033505-abo
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+130993@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'analytic/analytic.py'
2--- analytic/analytic.py 2012-10-05 14:36:06 +0000
3+++ analytic/analytic.py 2012-10-23 12:50:21 +0000
4@@ -255,27 +255,27 @@
5 if context is None:
6 context={}
7 if context.get('current_model') == 'project.project':
8- cr.execute("select analytic_account_id from project_project")
9- project_ids = [x[0] for x in cr.fetchall()]
10+ project_obj = self.pool.get("account.analytic.account")
11+ project_ids = project_obj.search(cr, uid, args)
12 return self.name_get(cr, uid, project_ids, context=context)
13 if name:
14- account = self.search(cr, uid, [('code', '=', name)] + args, limit=limit, context=context)
15- if not account:
16+ account_ids = self.search(cr, uid, [('code', '=', name)] + args, limit=limit, context=context)
17+ if not account_ids:
18 names=map(lambda i : i.strip(),name.split('/'))
19 for i in range(len(names)):
20 dom=[('name', operator, names[i])]
21 if i>0:
22- dom+=[('id','child_of',account)]
23- account = self.search(cr, uid, dom, limit=limit, context=context)
24- newacc = account
25+ dom+=[('id','child_of',account_ids)]
26+ account_ids = self.search(cr, uid, dom, limit=limit, context=context)
27+ newacc = account_ids
28 while newacc:
29 newacc = self.search(cr, uid, [('parent_id', 'in', newacc)], limit=limit, context=context)
30- account += newacc
31+ account_ids += newacc
32 if args:
33- account = self.search(cr, uid, [('id', 'in', account)] + args, limit=limit, context=context)
34+ account_ids = self.search(cr, uid, [('id', 'in', account_ids)] + args, limit=limit, context=context)
35 else:
36- account = self.search(cr, uid, args, limit=limit, context=context)
37- return self.name_get(cr, uid, account, context=context)
38+ account_ids = self.search(cr, uid, args, limit=limit, context=context)
39+ return self.name_get(cr, uid, account_ids, context=context)
40
41 def create(self, cr, uid, vals, context=None):
42 contract = super(account_analytic_account, self).create(cr, uid, vals, context=context)

Subscribers

People subscribed via source and target branches

to all changes: