Merge lp:~openerp-community/openobject-addons/trunk-bugfix-768994 into lp:openobject-addons

Proposed by Jacques-Etienne Baudoux
Status: Merged
Merged at revision: 4668
Proposed branch: lp:~openerp-community/openobject-addons/trunk-bugfix-768994
Merge into: lp:openobject-addons
Diff against target: 43 lines (+18/-8)
1 file modified
analytic/analytic.py (+18/-8)
To merge this branch: bzr merge lp:~openerp-community/openobject-addons/trunk-bugfix-768994
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+58820@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 2011-04-07 11:41:45 +0000
+++ analytic/analytic.py 2011-04-22 14:30:58 +0000
@@ -150,7 +150,7 @@
150 _columns = {150 _columns = {
151 'name': fields.char('Account Name', size=128, required=True),151 'name': fields.char('Account Name', size=128, required=True),
152 'complete_name': fields.function(_complete_name_calc, method=True, type='char', string='Full Account Name'),152 'complete_name': fields.function(_complete_name_calc, method=True, type='char', string='Full Account Name'),
153 'code': fields.char('Account Code', size=24),153 'code': fields.char('Account Code', size=24, select=True),
154 'type': fields.selection([('view','View'), ('normal','Normal')], 'Account Type', help='If you select the View Type, it means you won\'t allow to create journal entries using that account.'),154 'type': fields.selection([('view','View'), ('normal','Normal')], 'Account Type', help='If you select the View Type, it means you won\'t allow to create journal entries using that account.'),
155 'description': fields.text('Description'),155 'description': fields.text('Description'),
156 'parent_id': fields.many2one('account.analytic.account', 'Parent Analytic Account', select=2),156 'parent_id': fields.many2one('account.analytic.account', 'Parent Analytic Account', select=2),
@@ -245,13 +245,23 @@
245 cr.execute("select analytic_account_id from project_project")245 cr.execute("select analytic_account_id from project_project")
246 project_ids = [x[0] for x in cr.fetchall()]246 project_ids = [x[0] for x in cr.fetchall()]
247 return self.name_get(cr, uid, project_ids, context=context)247 return self.name_get(cr, uid, project_ids, context=context)
248 account = self.search(cr, uid, [('code', '=', name)] + args, limit=limit, context=context)248 if name:
249 if not account:249 account = self.search(cr, uid, [('code', '=', name)] + args, limit=limit, context=context)
250 account = self.search(cr, uid, [('name', 'ilike', '%%%s%%' % name)] + args, limit=limit, context=context)250 if not account:
251 newacc = account251 names=map(lambda i : i.strip(),name.split('/'))
252 while newacc:252 for i in range(len(names)):
253 newacc = self.search(cr, uid, [('parent_id', 'in', newacc)]+args, limit=limit, context=context)253 dom=[('name', operator, names[i])]
254 account += newacc254 if i>0:
255 dom+=[('id','child_of',account)]
256 account = self.search(cr, uid, dom, limit=limit, context=context)
257 newacc = account
258 while newacc:
259 newacc = self.search(cr, uid, [('parent_id', 'in', newacc)], limit=limit, context=context)
260 account += newacc
261 if args:
262 account = self.search(cr, uid, [('id', 'in', account)] + args, limit=limit, context=context)
263 else:
264 account = self.search(cr, uid, args, limit=limit, context=context)
255 return self.name_get(cr, uid, account, context=context)265 return self.name_get(cr, uid, account, context=context)
256266
257account_analytic_account()267account_analytic_account()

Subscribers

People subscribed via source and target branches

to all changes: