diff --git a/addons/account/report/account_balance.py b/addons/account/report/account_balance.py index d39599409a4..a183758b094 100755 --- a/addons/account/report/account_balance.py +++ b/addons/account/report/account_balance.py @@ -142,6 +142,7 @@ class account_balance(report_sxw.rml_parse): return cmp(x.code, y.code) accounts.sort(cmp_code) for account in accounts: + if account.id in done: continue done[account.id] = 1 @@ -169,9 +170,11 @@ class account_balance(report_sxw.rml_parse): self.sum_credit += account.credit if not (res['credit'] or res['debit']) and not account.child_id: continue + if account.child_id: def _check_rec(account): if not account.child_id: + print"(account.credit or account.debit)",bool(account.credit or account.debit) return bool(account.credit or account.debit) for c in account.child_id: if _check_rec(c): @@ -187,6 +190,7 @@ class account_balance(report_sxw.rml_parse): result_acc.append(res) else: result_acc.append(res) + print"account.id",account.id res1 = self.moveline(form, account.id,res['level']) if res1: for r in res1: @@ -197,10 +201,12 @@ class account_balance(report_sxw.rml_parse): ids2 = [(x.code,x.id) for x in account.child_id] ids2.sort() result_acc += self.lines(form, [x[1] for x in ids2], done, level+1) + return result_acc def moveline(self,form,ids,level): res={} + print"str(ids)",str(ids) self.date_lst_string = '\'' + '\',\''.join(map(str,self.date_lst)) + '\'' self.cr.execute( "SELECT l.id as lid,l.date,j.code as jname, l.ref, l.name as lname, l.debit as debit1, l.credit as credit1 " \ @@ -227,7 +233,7 @@ class account_balance(report_sxw.rml_parse): r['credit']='' r['balance']='' r['leef']='' - if sum > 0.0: + if sum >= 0.0: r['bal_type']=" Dr." else: r['bal_type']=" Cr." diff --git a/addons/account/report/general_ledger.py b/addons/account/report/general_ledger.py index e00a594f95f..a2b5f729e67 100755 --- a/addons/account/report/general_ledger.py +++ b/addons/account/report/general_ledger.py @@ -118,6 +118,7 @@ class general_ledger(rml_parse.rml_parse): self.child_ids = self.pool.get('account.account').search(self.cr, self.uid, [('parent_id', 'child_of', self.ids)]) + res = [] ctx = self.context.copy() ## We will make the test for period or date @@ -140,6 +141,7 @@ class general_ledger(rml_parse.rml_parse): child_account = self.pool.get('account.account').browse(self.cr, self.uid, child_id) sold_account = self._sum_solde_account(child_account,form) + self.sold_accounts[child_account.id] = sold_account if form['display_account'] == 'bal_mouvement': @@ -159,7 +161,7 @@ class general_ledger(rml_parse.rml_parse): else: if child_account.type != 'view' \ and len(self.pool.get('account.move.line').search(self.cr, self.uid, - [('account_id','=',child_account.id)], + [('account_id','>=',child_account.id)], context=ctx)) <> 0 : res.append(child_account) @@ -167,6 +169,7 @@ class general_ledger(rml_parse.rml_parse): ## We will now compute solde initiaux + if not len(res): return[account] else: @@ -270,7 +273,6 @@ class general_ledger(rml_parse.rml_parse): def lines(self, account, form): - inv_types = { 'out_invoice': 'CI: ', 'in_invoice': 'SI: ', @@ -313,7 +315,7 @@ class general_ledger(rml_parse.rml_parse): l['partner'] = line.partner_id.name else : l['partner'] = '' - sum += l['debit'] - l ['credit'] + sum = l['debit'] - l ['credit'] c = time.strptime(l['date'],"%Y-%m-%d") l['date'] = time.strftime("%d-%m-%Y",c) l['progress'] = sum diff --git a/addons/account/report/general_ledger.rml b/addons/account/report/general_ledger.rml index 83589f5f497..a18e1777617 100755 --- a/addons/account/report/general_ledger.rml +++ b/addons/account/report/general_ledger.rml @@ -35,13 +35,13 @@ - + - + @@ -91,9 +91,9 @@ - [[ data['form']['amount_currency'] == False or removeParentNode('blockTable') ]] + [[ data['form']['amount_currency'] == False or removeParentNode('blockTable') ]] - Date + Date Partner Ref Mvt @@ -102,9 +102,10 @@ Crebit Balance - [[ repeatIn(objects, 'a') ]] - [[ repeatIn(get_children_accounts(a,data['form']), 'o') ]] + + [[ repeatIn(objects, 'a') ]] + [[ repeatIn(get_children_accounts(a,data['form']), 'o') ]] @@ -114,25 +115,32 @@ [[sum_credit_account(o, data['form']) or '0.0' ]] [[sum_solde_account(o, data['form']) or '0.0' ]] + + [[ repeatIn(lines(o, data['form']), 'line') ]] + + + [[ line['date'] or '' ]] + [[ line['partner'] or '']] + [[ line['ref'] or '']] + [[ line['move'] or '']] + [[ line['name'] or '' ]] + [[ line['debit'] or '0.0' ]] + [[ line['credit'] or '0.0' ]] + [[ line['progress'] or '0.0' ]] + + + + - [[ repeatIn(lines(o, data['form']), 'line') ]] - [[ line['date'] or '' ]] - [[ line['partner'] or '']] - [[ line['ref'] or '']] - [[ line['move'] or '']] - [[ line['name'] or '' ]] - [[ line['debit'] or '0.0' ]] - [[ line['credit'] or '0.0' ]] - [[ line['progress'] or '0.0' ]] - + - [[ data['form']['amount_currency'] == True or removeParentNode('blockTable') ]] + [[ data['form']['amount_currency'] == True or removeParentNode('blockTable') ]] - Date + Date Partner Ref Mvt @@ -142,9 +150,10 @@ Balance Currency + + [[ repeatIn(objects, 'a') ]] [[ repeatIn(get_children_accounts(a,data['form']), 'o') ]] - @@ -155,20 +164,27 @@ [[sum_solde_account(o, data['form']) or '0.0' ]] [[ sum_currency_amount_account(a, data['form']) or '0.0' ]] + + [[ repeatIn(lines(o, data['form']), 'line') ]] + + + [[ line['date'] or '' ]] + [[ line['partner'] or '' ]] + [[ line['ref'] or '']] + [[ line['move'] or '' ]] + [[ line['name'] or '' ]] + [[ line['debit'] and line['debit'] or '0.0' ]] + [[ line['credit'] and line['credit'] or '0.0' ]] + [[ line['progress'] and line['progress'] or '0.0' ]] + [[ line['amount_currency'] or '0.0' ]] [[ line['currency_code'] or '']] + + + + - [[ repeatIn(lines(o, data['form']), 'line') ]] - [[ line['date'] or '' ]] - [[ line['partner'] or '' ]] - [[ line['ref'] or '']] - [[ line['move'] or '' ]] - [[ line['name'] or '' ]] - [[ line['debit'] and line['debit'] or '0.0' ]] - [[ line['credit'] and line['credit'] or '0.0' ]] - [[ line['progress'] and line['progress'] or '0.0' ]] - [[ line['amount_currency'] or '0.0' ]] [[ line['currency_code'] or '']] - + diff --git a/addons/account/report/general_ledger_landscape.py b/addons/account/report/general_ledger_landscape.py index 78d6e5bce4e..93c7766073e 100755 --- a/addons/account/report/general_ledger_landscape.py +++ b/addons/account/report/general_ledger_landscape.py @@ -220,7 +220,7 @@ class general_ledger_landscape(rml_parse.rml_parse): else: if child_account.type != 'view' \ and len(self.pool.get('account.move.line').search(self.cr, self.uid, - [('account_id','=',child_account.id)], + [('account_id','>=',child_account.id)], context=ctx)) <> 0 : res.append(child_account) ##