[IMP] account :account balance report level improvement, aged partner balance : code indentation currected.

bzr revid: vra@tinyerp.com-20100809121914-d305ysray2s4v01w
This commit is contained in:
vra 2010-08-09 17:49:14 +05:30
parent e0422d53a1
commit 9c0246174d
2 changed files with 16 additions and 17 deletions

View File

@ -49,18 +49,17 @@ class aged_trial_report(rml_parse.rml_parse, common_report_header):
self.query = data['form'].get('query_line', '')
self.direction_selection = data['form'].get('direction_selection', 'past')
self.date_from = data['form'].get('date_from', time.strftime('%Y-%m-%d'))
if (data['form']['result_selection'] == 'customer' ):
self.ACCOUNT_TYPE = ['receivable']
elif (data['form']['result_selection'] == 'supplier'):
self.ACCOUNT_TYPE = ['payable']
else:
self.ACCOUNT_TYPE = ['payable','receivable']
return super(aged_trial_report, self).set_context(objects, data, ids, report_type=report_type)
def _get_lines(self, form):
res = []
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
if (form['result_selection'] == 'customer' ):
self.ACCOUNT_TYPE = ['receivable']
elif (form['result_selection'] == 'supplier'):
self.ACCOUNT_TYPE = ['payable']
else:
self.ACCOUNT_TYPE = ['payable','receivable']
self.cr.execute('SELECT DISTINCT res_partner.id AS id,\
res_partner.name AS name \
FROM res_partner,account_move_line AS l, account_account\
@ -129,8 +128,8 @@ class aged_trial_report(rml_parse.rml_parse, common_report_header):
# Use one query per period and store results in history (a list variable)
# Each history will contain : history[1] = {'<partner_id>': <partner_debit-credit>}
history = []
for i in range(5):
history = []
for i in range(5):
self.cr.execute('SELECT partner_id, SUM(debit-credit)\
FROM account_move_line AS l, account_account\
WHERE (l.account_id = account_account.id)\

View File

@ -67,7 +67,7 @@ class account_balance(report_sxw.rml_parse, common_report_header):
return self.pool.get('account.account').browse(self.cr, self.uid, data['form']['id']).company_id.name
return super(account_balance ,self)._get_account(data)
def lines(self, form, ids=[], done=None, level=1):
def lines(self, form, ids=[], done=None):#, level=1):
obj_account = self.pool.get('account.account')
if not ids:
ids = self.ids
@ -94,7 +94,7 @@ class account_balance(report_sxw.rml_parse, common_report_header):
child_ids = obj_account._get_children_and_consol(self.cr, self.uid, ids, ctx)
if child_ids:
ids = child_ids
accounts = obj_account.read(self.cr, self.uid, ids, ['type','code','name','debit','credit','balance','parent_id'], ctx)
accounts = obj_account.read(self.cr, self.uid, ids, ['type','code','name','debit','credit','balance','parent_id','level'], ctx)
for account in accounts:
if account['id'] in done:
continue
@ -104,7 +104,7 @@ class account_balance(report_sxw.rml_parse, common_report_header):
'type': account['type'],
'code': account['code'],
'name': account['name'],
'level': level,
'level': account['level'],
'debit': account['debit'],
'credit': account['credit'],
'balance': account['balance'],
@ -124,12 +124,12 @@ class account_balance(report_sxw.rml_parse, common_report_header):
# return False
# if not _check_rec(account) :
# continue
if account['parent_id']:
# if account['parent_id']:
# acc = obj_account.read(self.cr, self.uid, [ account['parent_id'][0] ] ,['name'], ctx)
for r in result_acc:
if r['id'] == account['parent_id'][0]:
res['level'] = r['level'] + 1
break
# for r in result_acc:
# if r['id'] == account['parent_id'][0]:
# res['level'] = r['level'] + 1
# break
if form['display_account'] == 'bal_movement':
if res['credit'] > 0 or res['debit'] > 0 or res['balance'] > 0 :
result_acc.append(res)