Both General ledger completed

bzr revid: patelamit2003@gmail.com-20081105091850-944ly91s4zlfrapb
This commit is contained in:
apa-tiny 2008-11-05 14:48:50 +05:30
parent 75472ce889
commit 9000f79396
4 changed files with 59 additions and 35 deletions

View File

@ -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."

View File

@ -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

View File

@ -35,13 +35,13 @@
<blockTableStyle id="tbl_header">
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,0" stop="-1,0"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,2" stop="-1,-1"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="tbl_content">
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,1" stop="-1,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
<blockValign value="TOP"/>
</blockTableStyle>
@ -91,9 +91,9 @@
</stylesheet>
<story>
<blockTable colWidths="54.0,135.0,70.0,40.0,80.0,59.0,52.0,54.0" style="tbl_header" repeatRows="1">[[ data['form']['amount_currency'] == False or removeParentNode('blockTable') ]]
<blockTable colWidths="66.0,124.0,70.0,40.0,80.0,59.0,52.0,54.0" style="tbl_header" repeatRows="1">[[ data['form']['amount_currency'] == False or removeParentNode('blockTable') ]]
<tr>
<td><para style="P3">Date</para></td>
<td><para style="date">Date</para></td>
<td><para style="P3">Partner</para></td>
<td><para style="P3">Ref</para></td>
<td><para style="P3">Mvt</para></td>
@ -102,9 +102,10 @@
<td><para style="P4">Crebit</para></td>
<td><para style="P9">Balance</para></td>
</tr>
<para>[[ repeatIn(objects, 'a') ]]</para>
<para>[[ repeatIn(get_children_accounts(a,data['form']), 'o') ]]</para>
<tr>
<para>[[ repeatIn(objects, 'a') ]]</para>
<para>[[ repeatIn(get_children_accounts(a,data['form']), 'o') ]]</para>
<td>
<blockTable colWidths="280.0,100.0,52.5,52.5,52.5" style="Table5">
<tr>
@ -114,25 +115,32 @@
<td alignment="right"><para style="P9b"><u>[[sum_credit_account(o, data['form']) or '0.0' ]]</u></para></td>
<td><para style="P9b"><u>[[sum_solde_account(o, data['form']) or '0.0' ]]</u></para></td>
</tr>
<tr>
<td>[[ repeatIn(lines(o, data['form']), 'line') ]]
<blockTable colWidths="54.0,123.0,70.0,40.0,80.0,59.0,52.0,54.0" style="tbl_content">
<tr>
<td><para style="P3">[[ line['date'] or '' ]]</para></td>
<td><para style="P3">[[ line['partner'] or '']]</para></td>
<td><para style="P3">[[ line['ref'] or '']]</para></td>
<td><para style="P3">[[ line['move'] or '']]</para></td>
<td><para style="P3">[[ line['name'] or '' ]]</para></td>
<td><para style="P4">[[ line['debit'] or '0.0' ]]</para></td>
<td><para style="P4">[[ line['credit'] or '0.0' ]]</para></td>
<td><para style="P4">[[ line['progress'] or '0.0' ]]</para></td>
</tr>
</blockTable>
</td>
</tr>
</blockTable>
</td>
</tr>
<tr>[[ repeatIn(lines(o, data['form']), 'line') ]]
<td><para style="P3">[[ line['date'] or '' ]]</para></td>
<td><para style="P3">[[ line['partner'] or '']]</para></td>
<td><para style="P3">[[ line['ref'] or '']]</para></td>
<td><para style="P3">[[ line['move'] or '']]</para></td>
<td><para style="P3">[[ line['name'] or '' ]]</para></td>
<td><para style="P4">[[ line['debit'] or '0.0' ]]</para></td>
<td><para style="P4">[[ line['credit'] or '0.0' ]]</para></td>
<td><para style="P4">[[ line['progress'] or '0.0' ]]</para></td>
</tr>
</blockTable>
<blockTable colWidths="59.0,105.0,66.0,40.0,100.0,50.0,50.0,50.0,40.0" style="tbl_header" repeatRows="1">[[ data['form']['amount_currency'] == True or removeParentNode('blockTable') ]]
<blockTable colWidths="72.0,93.0,66.0,40.0,100.0,50.0,50.0,50.0,40.0" style="tbl_header" repeatRows="1">[[ data['form']['amount_currency'] == True or removeParentNode('blockTable') ]]
<tr>
<td><para style="P3">Date</para></td>
<td><para style="date">Date</para></td>
<td><para style="P3">Partner</para></td>
<td><para style="P3">Ref</para></td>
<td><para style="P3">Mvt</para></td>
@ -142,9 +150,10 @@
<td><para style="P4">Balance</para></td>
<td><para style="P4">Currency</para></td>
</tr>
<tr>
<para>[[ repeatIn(objects, 'a') ]]</para>
<para>[[ repeatIn(get_children_accounts(a,data['form']), 'o') ]]</para>
<tr>
<td>
<blockTable colWidths="264.00,100.0,50.0,50.0,49.0,40.00" style="Table5">
<tr>
@ -155,20 +164,27 @@
<td><para style="P9b"><u>[[sum_solde_account(o, data['form']) or '0.0' ]]</u></para></td>
<td><para style="P9b"><u> [[ sum_currency_amount_account(a, data['form']) or '0.0' ]]</u></para></td>
</tr>
<tr>
<td>[[ repeatIn(lines(o, data['form']), 'line') ]]
<blockTable colWidths="59.0,93.0,66.0,40.0,100.0,50.0,50.0,50.0,40.0" style="tbl_content">
<tr>
<td><para style="P3">[[ line['date'] or '' ]]</para></td>
<td><para style="P3">[[ line['partner'] or '' ]]</para></td>
<td><para style="P3">[[ line['ref'] or '']]</para></td>
<td><para style="P3">[[ line['move'] or '' ]]</para></td>
<td><para style="P3">[[ line['name'] or '' ]]</para></td>
<td><para style="P4">[[ line['debit'] and line['debit'] or '0.0' ]]</para></td>
<td><para style="P4">[[ line['credit'] and line['credit'] or '0.0' ]]</para></td>
<td><para style="P4">[[ line['progress'] and line['progress'] or '0.0' ]]</para></td>
<td><para style="P4">[[ line['amount_currency'] or '0.0' ]] [[ line['currency_code'] or '']]</para></td>
</tr>
</blockTable>
</td>
</tr>
</blockTable>
</td>
</tr>
<tr>[[ repeatIn(lines(o, data['form']), 'line') ]]
<td><para style="P3">[[ line['date'] or '' ]]</para></td>
<td><para style="P3">[[ line['partner'] or '' ]]</para></td>
<td><para style="P3">[[ line['ref'] or '']]</para></td>
<td><para style="P3">[[ line['move'] or '' ]]</para></td>
<td><para style="P3">[[ line['name'] or '' ]]</para></td>
<td><para style="P4">[[ line['debit'] and line['debit'] or '0.0' ]]</para></td>
<td><para style="P4">[[ line['credit'] and line['credit'] or '0.0' ]]</para></td>
<td><para style="P4">[[ line['progress'] and line['progress'] or '0.0' ]]</para></td>
<td><para style="P4">[[ line['amount_currency'] or '0.0' ]] [[ line['currency_code'] or '']]</para></td>
</tr>
</blockTable>
</story>

View File

@ -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)
##