[IMP]: implement new method that computes the level of account
ref: developer by vra bzr revid: mga@tinyerp.com-20100520143343-cjk2u4fmjni6xjq9
This commit is contained in:
parent
6e8e41be7e
commit
d7cad67e0b
|
@ -297,6 +297,17 @@ class account_account(osv.osv):
|
|||
|
||||
return result
|
||||
|
||||
def _get_level(self, cr, uid, ids, field_name, arg, context={}):
|
||||
res={}
|
||||
accounts = self.browse(cr, uid, ids)
|
||||
for account in accounts:
|
||||
level = 0
|
||||
if account.parent_id :
|
||||
obj = self.browse(cr, uid, account.parent_id.id)
|
||||
level = obj.level + 1
|
||||
res[account.id] = level
|
||||
return res
|
||||
|
||||
_columns = {
|
||||
'name': fields.char('Name', size=128, required=True, select=True),
|
||||
'currency_id': fields.many2one('res.currency', 'Secondary Currency', help="Forces all moves for this account to have this secondary currency."),
|
||||
|
@ -343,6 +354,7 @@ class account_account(osv.osv):
|
|||
'check_history': fields.boolean('Display History',
|
||||
help="Check this box if you want to print all entries when printing the General Ledger, "\
|
||||
"otherwise it will only print its balance."),
|
||||
'level': fields.function(_get_level, string='Level', method=True, store=True, type='integer'),
|
||||
}
|
||||
|
||||
def _default_company(self, cr, uid, context={}):
|
||||
|
|
Loading…
Reference in New Issue