Modify general ledger report:

- add boolean field on account defincation (display history)..it its true it will display lines otherwise only balance of that account

bzr revid: mra@tinyerp.com-20080910095651-9b7eor3or39u7ma7
This commit is contained in:
Mustufa Rangwala 2008-09-10 15:26:51 +05:30
parent 85e611598b
commit 704a0a5c27
4 changed files with 105 additions and 102 deletions

View File

@ -244,6 +244,7 @@ class account_account(osv.osv):
'parent_left': fields.integer('Parent Left', select=1),
'parent_right': fields.integer('Parent Right', select=1),
'check_history': fields.boolean('Display History', help="Check this box if you want to print all entries otherwise it will print balance of this account")
}
def _default_company(self, cr, uid, context={}):
@ -257,6 +258,7 @@ class account_account(osv.osv):
'reconcile': lambda *a: False,
'company_id': _default_company,
'active': lambda *a: True,
'check_history': lambda *a: True,
}
def _check_recursion(self, cr, uid, ids):

View File

@ -124,6 +124,7 @@
<field name="user_type" select="1"/>
<field name="currency_id" select="2"/>
<field name="reconcile"/>
<field name="check_history"/>
<newline/>
<newline/>
<field name="child_consol_ids" colspan="4"/>

View File

@ -42,6 +42,7 @@ class general_ledger(report_sxw.rml_parse):
'sum_credit_account': self._sum_credit_account,
'sum_debit': self._sum_debit,
'sum_credit': self._sum_credit,
'check_lines': self.check_lines,
})
self.context = context
@ -101,8 +102,17 @@ class general_ledger(report_sxw.rml_parse):
return ret_data
def check_lines(self, account, form):
result = self.lines(account, form, history=True)
res = [{'code':account.code,'name':account.name}]
if not result:
res = []
return res
def lines(self, account, form):
self.ids +=[account.id]
if not account.check_history and not history:
return []
ctx = self.context.copy()
ctx['fiscalyear'] = form['fiscalyear']
@ -120,7 +130,6 @@ class general_ledger(report_sxw.rml_parse):
for l in res:
sum += l['debit'] - l ['credit']
l['progress'] = sum
self.ids +=[account.id]
return res
def _sum_debit_account(self, account, form):

View File

@ -13,63 +13,30 @@
<blockTableStyle id="Table1">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<blockBackground colorName="#e6e6e6" start="0,0" stop="0,-1"/>
<blockBackground colorName="#e6e6e6" start="1,0" stop="1,-1"/>
<blockBackground colorName="#e6e6e6" start="2,0" stop="2,-1"/>
<blockBackground colorName="#e6e6e6" start="0,1" stop="0,-1"/>
<blockBackground colorName="#e6e6e6" start="1,1" stop="1,-1"/>
<blockBackground colorName="#e6e6e6" start="2,1" stop="2,-1"/>
<blockBackground colorName="#e6e6e6" start="0,0" stop="0,0"/>
<blockBackground colorName="#e6e6e6" start="1,0" stop="1,0"/>
<blockBackground colorName="#e6e6e6" start="2,0" stop="2,0"/>
<blockBackground colorName="#e6e6e6" start="0,1" stop="0,1"/>
<blockBackground colorName="#e6e6e6" start="1,1" stop="1,1"/>
<blockBackground colorName="#e6e6e6" start="2,1" stop="2,1"/>
</blockTableStyle>
<blockTableStyle id="Table2">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBEFORE" colorName="#000000" start="0,0" stop="0,-1"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="0,0" stop="0,0"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#000000" start="1,0" stop="1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="1,0" stop="1,0"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#000000" start="2,0" stop="2,-1"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="2,0" stop="2,0"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#000000" start="3,0" stop="3,-1"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="3,0" stop="3,0"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#000000" start="4,0" stop="4,-1"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="4,0" stop="4,0"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#000000" start="5,0" stop="5,-1"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="5,0" stop="5,0"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="5,-1" stop="5,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#000000" start="6,0" stop="6,-1"/>
<lineStyle kind="LINEAFTER" colorName="#000000" start="6,0" stop="6,-1"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="6,0" stop="6,0"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="6,-1" stop="6,-1"/>
<lineStyle kind="GRID" colorName="black"/>
</blockTableStyle>
<blockTableStyle id="Table3">
<blockTableStyle id="Table7">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table5">
<blockTableStyle id="Table8">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table4">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBEFORE" colorName="#000000" start="0,0" stop="0,-1"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="0,0" stop="0,0"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#000000" start="1,0" stop="1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="1,0" stop="1,0"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#000000" start="2,0" stop="2,-1"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="2,0" stop="2,0"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEBEFORE" colorName="#000000" start="3,0" stop="3,-1"/>
<lineStyle kind="LINEAFTER" colorName="#000000" start="3,0" stop="3,-1"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="3,0" stop="3,0"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
<lineStyle kind="GRID" colorName="black"/>
</blockTableStyle>
<initialize>
<paraStyle name="all" alignment="justify"/>
@ -87,9 +54,16 @@
<paraStyle name="P11" fontName="Times-Roman" fontSize="11.0" leading="14"/>
<paraStyle name="P12" fontName="Times-Roman" fontSize="14.0" leading="17"/>
<paraStyle name="P13" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P14" fontName="Times-Roman" fontSize="8.0" leading="10" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P15" fontName="Times-Bold" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P16" rightIndent="17.0" leftIndent="-0.0" fontName="Times-Roman" fontSize="8.0" leading="10" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P14" rightIndent="17.0" leftIndent="-0.0" fontName="Times-Roman" fontSize="8.0" leading="10" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P15" rightIndent="0.0" leftIndent="0.0" fontName="Times-Bold" fontSize="10.0" leading="13"/>
<paraStyle name="P16" rightIndent="0.0" leftIndent="0.0" fontName="Times-Roman" fontSize="8.0" leading="10"/>
<paraStyle name="P17" rightIndent="0.0" leftIndent="0.0" fontName="Times-Roman" fontSize="8.0" leading="10" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P18" fontName="Times-Roman" fontSize="8.0" leading="10" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P19" fontName="Times-Roman" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P20" fontName="Times-Roman" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P21" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P22" fontName="Times-Roman" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="P23" rightIndent="17.0" leftIndent="-0.0" fontName="Times-Roman" fontSize="8.0" leading="10" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Standard" fontName="Times-Roman"/>
<paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="List" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
@ -97,8 +71,8 @@
<paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Caption" fontName="Times-Roman" fontSize="10.0" leading="13" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Index" fontName="Times-Roman"/>
<paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
</stylesheet>
<images/>
<story>
<blockTable colWidths="126.0,217.0,138.0" repeatRows="1" style="Table1">
<tr>
@ -137,7 +111,7 @@
<para style="P11">
<font color="white"> </font>
</para>
<blockTable colWidths="45.0,36.0,50.0,145.0,69.0,72.0,64.0" repeatRows="1" style="Table2">
<blockTable colWidths="48.0,34.0,50.0,145.0,69.0,72.0,64.0" repeatRows="1" style="Table2">
<tr>
<td>
<para style="P13">Date</para>
@ -165,59 +139,76 @@
<para style="Text body">
<font color="white"> </font>
</para>
<section>
<para style="P14">[[ repeatIn(objects, 'o') ]]</para>
<para style="P15">[[ o.code ]] [[ o.name ]]</para>
<blockTable colWidths="45.0,37.0,50.0,145.0,69.0,72.0,63.0" style="Table3">
<tr>
<td>
<para style="P16"><font face="Times-Roman">[[ repeatIn(lines(o, data['form']), 'line') ]]</font>[[ line['date'] ]]</para>
</td>
<td>
<para style="P2">[[ line['code'] ]]</para>
</td>
<td>
<para style="P2">[[ line['ref'] ]]</para>
</td>
<td>
<para style="P3">[[ line['name'] ]]</para>
</td>
<td>
<para style="P4">[[ formatLang(line['debit']) ]]</para>
</td>
<td>
<para style="P4">[[ formatLang(line['credit']) ]]</para>
</td>
<td>
<para style="P4">[[ formatLang(line['progress']) ]]</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="277.0,69.0,72.0,63.0" style="Table5">
<tr>
<td>
<para style="P8">TOTAL ([[ o.code ]]):</para>
</td>
<td>
<para style="P9">[[ formatLang(sum_debit_account(o, data['form'])) ]]</para>
</td>
<td>
<para style="P9">[[ formatLang(sum_credit_account(o, data['form'])) ]]</para>
</td>
<td>
<para style="P9">
<font color="white"> </font>
</para>
</td>
</tr>
</blockTable>
<para style="Standard">
<font color="white"> </font>
</para>
</section>
<para style="Text body">
<font color="white"> </font>
</para>
<blockTable colWidths="482.0" style="Table7">
<tr>
<td>
<para style="P17">[[ repeatIn(objects, 'o') ]] </para>
<para style="P17">[[ repeatIn(check_lines(o,data['form']), 'acc') ]]</para>
<para style="P17">
<font face="Times-Bold" size="10.0">[[ acc and acc['code'] or removeParentNode('para') ]] [[ acc and acc['name'] or removeParentNode('para') ]]</font>
</para>
<blockTable colWidths="44.0,38.0,50.0,144.0,69.0,72.0,64.0" style="Table8">
<tr>
<td>
<para style="P14"><font face="Times-Roman">[[ repeatIn(lines(o, data['form']), 'line') ]]</font>[[ line['date'] ]]</para>
</td>
<td>
<para style="P2">[[ line['code'] ]]</para>
</td>
<td>
<para style="P2">[[ line['ref'] ]]</para>
</td>
<td>
<para style="P3">[[ line['name'] ]]</para>
</td>
<td>
<para style="P4">[[ formatLang(line['debit']) ]]</para>
</td>
<td>
<para style="P4">[[ formatLang(line['credit']) ]]</para>
</td>
<td>
<para style="P4">[[ formatLang(line['progress']) ]]</para>
</td>
</tr>
<tr>
<td>
<para style="P14">
<font color="white"> </font>
</para>
<para style="P14">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P2">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P2">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P8">TOTAL (<font face="Times-Roman" size="10.0">[[ acc and acc['code'] or removeParentNode('para') ]]):</font></para>
</td>
<td>
<para style="P9">[[ formatLang(sum_debit_account(o, data['form'])) ]]</para>
</td>
<td>
<para style="P9">[[ formatLang(sum_credit_account(o, data['form'])) ]]</para>
</td>
<td>
<para style="P4">
<font color="white"> </font>
</para>
</td>
</tr>
</blockTable>
</td>
</tr>
</blockTable>
<blockTable colWidths="277.0,69.0,72.0,63.0" style="Table4">
<tr>
<td>