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
=== 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 @@
255 if context is None:255 if context is None:
256 context={}256 context={}
257 if context.get('current_model') == 'project.project':257 if context.get('current_model') == 'project.project':
258 cr.execute("select analytic_account_id from project_project")258 project_obj = self.pool.get("account.analytic.account")
259 project_ids = [x[0] for x in cr.fetchall()]259 project_ids = project_obj.search(cr, uid, args)
260 return self.name_get(cr, uid, project_ids, context=context)260 return self.name_get(cr, uid, project_ids, context=context)
261 if name:261 if name:
262 account = self.search(cr, uid, [('code', '=', name)] + args, limit=limit, context=context)262 account_ids = self.search(cr, uid, [('code', '=', name)] + args, limit=limit, context=context)
263 if not account:263 if not account_ids:
264 names=map(lambda i : i.strip(),name.split('/'))264 names=map(lambda i : i.strip(),name.split('/'))
265 for i in range(len(names)):265 for i in range(len(names)):
266 dom=[('name', operator, names[i])]266 dom=[('name', operator, names[i])]
267 if i>0:267 if i>0:
268 dom+=[('id','child_of',account)]268 dom+=[('id','child_of',account_ids)]
269 account = self.search(cr, uid, dom, limit=limit, context=context)269 account_ids = self.search(cr, uid, dom, limit=limit, context=context)
270 newacc = account270 newacc = account_ids
271 while newacc:271 while newacc:
272 newacc = self.search(cr, uid, [('parent_id', 'in', newacc)], limit=limit, context=context)272 newacc = self.search(cr, uid, [('parent_id', 'in', newacc)], limit=limit, context=context)
273 account += newacc273 account_ids += newacc
274 if args:274 if args:
275 account = self.search(cr, uid, [('id', 'in', account)] + args, limit=limit, context=context)275 account_ids = self.search(cr, uid, [('id', 'in', account_ids)] + args, limit=limit, context=context)
276 else:276 else:
277 account = self.search(cr, uid, args, limit=limit, context=context)277 account_ids = self.search(cr, uid, args, limit=limit, context=context)
278 return self.name_get(cr, uid, account, context=context)278 return self.name_get(cr, uid, account_ids, context=context)
279279
280 def create(self, cr, uid, vals, context=None):280 def create(self, cr, uid, vals, context=None):
281 contract = super(account_analytic_account, self).create(cr, uid, vals, context=context)281 contract = super(account_analytic_account, self).create(cr, uid, vals, context=context)

Subscribers

People subscribed via source and target branches

to all changes: