[MERGE] lp:783670 about level computation of accounts
bzr revid: qdp-launchpad@openerp.com-20111026090010-ok929g2rb24qpk44
This commit is contained in:
commit
c229d793b2
|
@ -350,9 +350,10 @@ class account_account(osv.osv):
|
|||
accounts = self.browse(cr, uid, ids, context=context)
|
||||
for account in accounts:
|
||||
level = 0
|
||||
if account.parent_id:
|
||||
obj = self.browse(cr, uid, account.parent_id.id)
|
||||
level = obj.level + 1
|
||||
parent = account.parent_id
|
||||
while parent:
|
||||
level += 1
|
||||
parent = parent.parent_id
|
||||
res[account.id] = level
|
||||
return res
|
||||
|
||||
|
@ -453,7 +454,10 @@ class account_account(osv.osv):
|
|||
'manage this. So if you import from another software system you may have to use the rate at date. ' \
|
||||
'Incoming transactions always use the rate at date.', \
|
||||
required=True),
|
||||
'level': fields.function(_get_level, string='Level', store=True, type='integer'),
|
||||
'level': fields.function(_get_level, string='Level', method=True, type='integer',
|
||||
store={
|
||||
'account.account': (_get_children_and_consol, ['level', 'parent_id'], 10),
|
||||
}),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
|
|
Loading…
Reference in New Issue