account balance prob solved
bzr revid: patelamit2003@gmail.com-20081105133630-0bavqlimhmwks4n4
This commit is contained in:
parent
17e08f125a
commit
612074da96
|
@ -1,7 +1,7 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
||||
# $Id$
|
||||
#
|
||||
|
@ -142,19 +142,19 @@ 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
|
||||
res = {
|
||||
'lid' :'',
|
||||
'date':'',
|
||||
'jname':'',
|
||||
'ref':'',
|
||||
'lname':'',
|
||||
'debit1':'',
|
||||
'credit1':'',
|
||||
'balance1' :'',
|
||||
# 'lid' :'',
|
||||
# 'date':'',
|
||||
# 'jname':'',
|
||||
# 'ref':'',
|
||||
# 'lname':'',
|
||||
# 'debit1':'',
|
||||
# 'credit1':'',
|
||||
# 'balance1' :'',
|
||||
'id' : account.id,
|
||||
'type' : account.type,
|
||||
'code': account.code,
|
||||
|
@ -168,45 +168,48 @@ class account_balance(report_sxw.rml_parse):
|
|||
}
|
||||
self.sum_debit += account.debit
|
||||
self.sum_credit += account.credit
|
||||
if not (res['credit'] or res['debit']) and not account.child_id:
|
||||
continue
|
||||
|
||||
# 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):
|
||||
if not _check_rec(c):
|
||||
return True
|
||||
return False
|
||||
if not _check_rec(account):
|
||||
if not _check_rec(account) :
|
||||
continue
|
||||
|
||||
|
||||
if form['display_account'] == 'bal_mouvement':
|
||||
if res['credit'] <> 0 or res['debit'] <> 0 or res['balance'] <> 0:
|
||||
if res['credit'] >= 0 or res['debit'] >= 0 or res['balance'] >= 0 :
|
||||
result_acc.append(res)
|
||||
elif form['display_account'] == 'bal_solde':
|
||||
if res['balance'] <> 0:
|
||||
if res['balance'] >= 0:
|
||||
result_acc.append(res)
|
||||
else:
|
||||
result_acc.append(res)
|
||||
|
||||
|
||||
|
||||
|
||||
res1 = self.moveline(form, account.id,res['level'])
|
||||
if res1:
|
||||
for r in res1:
|
||||
result_acc.append(r)
|
||||
if account.code=='0':
|
||||
result_acc.pop(-1)
|
||||
# if account.code=='0':
|
||||
# result_acc.pop(-1)
|
||||
if account.child_id:
|
||||
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 " \
|
||||
|
@ -277,4 +280,4 @@ class account_balance(report_sxw.rml_parse):
|
|||
def _sum_debit(self):
|
||||
return self.sum_debit
|
||||
|
||||
report_sxw.report_sxw('report.account.account.balance', 'account.account', 'addons/account/report/account_balance.rml', parser=account_balance, header=False)
|
||||
report_sxw.report_sxw('report.account.account.balance', 'account.account', 'addons/account/report/account_balance.rml', parser=account_balance, header=False)
|
|
@ -2,7 +2,7 @@
|
|||
<document filename="test.pdf">
|
||||
<template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
|
||||
<pageTemplate id="first">
|
||||
<frame id="first" x1="35.0" y1="35.0" width="525" height="772"/>
|
||||
<frame id="first" x1="57.0" y1="57.0" width="481" height="728"/>
|
||||
<pageGraphics>
|
||||
<setFont name="Helvetica-Bold" size="9"/>
|
||||
|
||||
|
@ -15,11 +15,11 @@
|
|||
<setFont name="Helvetica" size="9"/>
|
||||
<drawString x="1.0cm" y="1cm"> [[ time.strftime("%m-%d-%y %H:%M", time.localtime()) ]]</drawString>
|
||||
<drawString x="19.0cm" y="1cm">Page <pageNumber/></drawString>
|
||||
|
||||
|
||||
<lineMode width="0.7"/>
|
||||
<lines>1cm 27.7cm 20cm 27.7cm</lines>
|
||||
<setFont name="Helvetica" size="8"/>
|
||||
|
||||
|
||||
</pageGraphics>
|
||||
|
||||
</pageTemplate>
|
||||
|
@ -126,25 +126,29 @@
|
|||
</blockTableStyle>
|
||||
|
||||
<paraStyle
|
||||
name="Level5"
|
||||
name="Level6"
|
||||
fontName="Helvetica"
|
||||
fontSize="8.0" />
|
||||
<paraStyle
|
||||
name="Level4"
|
||||
fontName="Helvetica"
|
||||
name="Level5"
|
||||
fontName="Helvetica"
|
||||
fontSize="8.0" />
|
||||
<paraStyle
|
||||
name="Level3"
|
||||
fontName="Helvetica"
|
||||
name="Level4"
|
||||
fontName="Helvetica"
|
||||
fontSize="8.0" />
|
||||
<paraStyle
|
||||
name="Level2"
|
||||
name="Level3"
|
||||
fontName="Helvetica"
|
||||
fontSize="8.0" />
|
||||
<paraStyle
|
||||
name="Level2"
|
||||
firstLineIndent="-0.03cm"
|
||||
fontName="Helvetica-Bold"
|
||||
fontName="Helvetica-Bold"
|
||||
fontSize="8.0" />
|
||||
<paraStyle name="Level1"
|
||||
fontSize="8.0"
|
||||
fontName="Helvetica-Bold"
|
||||
fontName="Helvetica-Bold"
|
||||
/>
|
||||
<paraStyle name="Caption" fontName="Helvetica" fontSize="10.0" leading="13" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Index" fontName="Helvetica"/>
|
||||
|
@ -170,7 +174,7 @@
|
|||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="46,278.0,73.0,72.0,82.0" style="Table2" repeatRows="1">
|
||||
<tr>
|
||||
<tr noRowsplits="1">
|
||||
<td>
|
||||
<para style="P12a">Code</para>
|
||||
</td>
|
||||
|
@ -195,19 +199,18 @@
|
|||
[[ a['name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3"><font>[[ a['type']=='view' and removeParentNode('font') ]][[ a['debit'] and formatLang(a['debit']) or '0.00' ]]</font>
|
||||
<font><u>[[ a['type']<>'view' and removeParentNode('font') ]] [[a['debit'] and formatLang(a['debit']) or '0.00' ]]</u></font></para>
|
||||
<para style="P3"><font>[[ a['type']=='view' and removeParentNode('font') ]][[ a['debit'] and formatLang(a['debit']) or '0.00' ]]</font>
|
||||
<font>[[ a['type']<>'view' and removeParentNode('font') ]] [[a['debit'] and formatLang(a['debit']) or '0.00' ]]</font></para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3"><font>[[ a['type']=='view' and removeParentNode('font') ]][[ a['credit'] and formatLang(a['credit']) or '0.00' ]]</font>
|
||||
<font><u>[[ a['type']<>'view' and removeParentNode('font') ]] [[a['credit'] and formatLang(a['credit']) or '0.00' ]]</u></font></para>
|
||||
<para style="P3"><font>[[ a['type']=='view' and removeParentNode('font') ]][[ a['credit'] and formatLang(a['credit']) or '0.00' ]]</font>
|
||||
<font>[[ a['type']<>'view' and removeParentNode('font') ]] [[a['credit'] and formatLang(a['credit']) or '0.00' ]]</font></para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3"><font>[[ a['type']=='view' and removeParentNode('font') ]][[ a['balance'] and formatLang(a['balance']) or '0.00' ]]</font>
|
||||
<font><u>[[ a['type']<>'view' and removeParentNode('font') ]] [[a['balance'] and formatLang(a['balance']) or '0.00' ]]</u></font></para>
|
||||
<para style="P3"><font>[[ a['type']=='view' and removeParentNode('font') ]][[ a['balance'] and formatLang(a['balance']) or '0.00' ]]</font>
|
||||
<font>[[ a['type']<>'view' and removeParentNode('font') ]] [[a['balance'] and formatLang(a['balance']) or '0.00' ]]</font></para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
</story>
|
||||
</document>
|
||||
|
||||
|
|
Loading…
Reference in New Issue