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
1=== modified file 'analytic/analytic.py'
2--- analytic/analytic.py 2011-04-07 11:41:45 +0000
3+++ analytic/analytic.py 2011-04-22 14:30:58 +0000
4@@ -150,7 +150,7 @@
5 _columns = {
6 'name': fields.char('Account Name', size=128, required=True),
7 'complete_name': fields.function(_complete_name_calc, method=True, type='char', string='Full Account Name'),
8- 'code': fields.char('Account Code', size=24),
9+ 'code': fields.char('Account Code', size=24, select=True),
10 '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.'),
11 'description': fields.text('Description'),
12 'parent_id': fields.many2one('account.analytic.account', 'Parent Analytic Account', select=2),
13@@ -245,13 +245,23 @@
14 cr.execute("select analytic_account_id from project_project")
15 project_ids = [x[0] for x in cr.fetchall()]
16 return self.name_get(cr, uid, project_ids, context=context)
17- account = self.search(cr, uid, [('code', '=', name)] + args, limit=limit, context=context)
18- if not account:
19- account = self.search(cr, uid, [('name', 'ilike', '%%%s%%' % name)] + args, limit=limit, context=context)
20- newacc = account
21- while newacc:
22- newacc = self.search(cr, uid, [('parent_id', 'in', newacc)]+args, limit=limit, context=context)
23- account += newacc
24+ if name:
25+ account = self.search(cr, uid, [('code', '=', name)] + args, limit=limit, context=context)
26+ if not account:
27+ names=map(lambda i : i.strip(),name.split('/'))
28+ for i in range(len(names)):
29+ dom=[('name', operator, names[i])]
30+ if i>0:
31+ dom+=[('id','child_of',account)]
32+ account = self.search(cr, uid, dom, limit=limit, context=context)
33+ newacc = account
34+ while newacc:
35+ newacc = self.search(cr, uid, [('parent_id', 'in', newacc)], limit=limit, context=context)
36+ account += newacc
37+ if args:
38+ account = self.search(cr, uid, [('id', 'in', account)] + args, limit=limit, context=context)
39+ else:
40+ account = self.search(cr, uid, args, limit=limit, context=context)
41 return self.name_get(cr, uid, account, context=context)
42
43 account_analytic_account()

Subscribers

People subscribed via source and target branches

to all changes: