Browse Source

[ADD][balance_full_4_cols_journal_ledger] add boolean field " journal ledger" and its report

pull/7/merge
Fernando.rangel 12 years ago
parent
commit
ad65abc6db
  1. 107
      account_financial_report/report/balance_full_4_cols_journal_ledger.rml
  2. 42
      account_financial_report/report/parser.py
  3. 1
      account_financial_report/view/wizard.xml

107
account_financial_report/report/balance_full_cols_journal_ledger.rml → account_financial_report/report/balance_full_4_cols_journal_ledger.rml

@ -89,6 +89,20 @@
alignment="LEFT" alignment="LEFT"
spaceBefore="0.0" spaceBefore="0.0"
spaceAfter="0.0"/> spaceAfter="0.0"/>
<paraStyle name="TITLES_NEW_P"
fontName="Helvetica-Bold"
fontSize="6.0"
leading="10"
alignment="LEFT"
spaceBefore="0.0"
spaceAfter="0.0"/>
<paraStyle name="TITLES_NEW_RIGHT"
fontName="Courier"
fontSize="7.0"
leading="10"
alignment="RIGHT"
spaceBefore="0.0"
spaceAfter="0.0"/>
<paraStyle <paraStyle
name="TITLE_LEFT_ALIGN" name="TITLE_LEFT_ALIGN"
fontName="Helvetica-Bold" fontName="Helvetica-Bold"
@ -145,8 +159,7 @@
</td> </td>
</tr> </tr>
</blockTable> </blockTable>
<blockTable colWidths="2.25cm,2.0cm,7.75cm,2.5cm,4.0cm,2.5cm,2.5cm,2.5cm" style="BODY_LINE" repeatRows="1">
<blockTable colWidths="6.0cm,3.0cm,3.0cm,2.5cm,4.0cm,2.5cm,2.5cm,2.5cm" style="BODY_LINE" repeatRows="0">
<!-- <!--
[[ (a['type'] &lt;&gt; 'view') or removeParentNode('blockTable') ]] [[ (a['type'] &lt;&gt; 'view') or removeParentNode('blockTable') ]]
--> -->
@ -162,13 +175,13 @@
</para> </para>
</td> </td>
<td> <td>
<para style="TITLES_NEW">REFERENCE</para>
<para style="TITLES_NEW">JOURNAL ENTRY</para>
</td> </td>
<td> <td>
<para style="TITLES_NEW">JOURNAL ENTRY</para>
<para style="TITLE_LEFT_ALIGN"></para>
</td> </td>
<td> <td>
<para style="TITLES_NEW">PARTNER</para>
<para style="TITLE_LEFT_ALIGN"></para>
</td> </td>
<td> <td>
<para style="TITLE_LEFT_ALIGN"></para> <para style="TITLE_LEFT_ALIGN"></para>
@ -181,11 +194,6 @@
</td> </td>
</tr> </tr>
</blockTable> </blockTable>
<section> <section>
<para>[[ repeatIn([x for x in lines(data['form']) if x['type'] != 'view'], 'a') ]]</para> <para>[[ repeatIn([x for x in lines(data['form']) if x['type'] != 'view'], 'a') ]]</para>
<blockTable colWidths="2.5cm,13.5cm,2.5cm,2.5cm,2.5cm,2.5cm" style="BODY" repeatRows="0"> <blockTable colWidths="2.5cm,13.5cm,2.5cm,2.5cm,2.5cm,2.5cm" style="BODY" repeatRows="0">
@ -230,63 +238,104 @@
</blockTable> </blockTable>
<section> <section>
<para>[[ repeatIn(a['mayor'], 'm') ]]</para>
<blockTable colWidths="2.25cm,2.0cm,7.75cm,2.5cm,4.0cm,2.5cm,2.5cm,2.5cm" style="BODY_LINE" repeatRows="1">
<para>[[ repeatIn(a['journal'], 'j') ]]</para>
<blockTable colWidths="6.0cm,3.0cm,3.0cm,2.5cm,4.0cm,2.5cm,2.5cm,2.5cm" style="BODY_LINE" repeatRows="1">
<!-- <!--
[[ (a['type'] &lt;&gt; 'view') or removeParentNode('blockTable') ]] [[ (a['type'] &lt;&gt; 'view') or removeParentNode('blockTable') ]]
--> -->
<tr> <tr>
<td>
<para style="TITLES_NEW_P">
<font> [[ formatLang( j['date'], date=True) ]]</font>
</para>
</td>
<td>
<para style="TITLES_NEW_P">
<font>[[ j['period'] ]]</font>
</para>
</td>
<td>
<para style="TITLES_NEW_P">
<font>[[ j['name'] ]] </font>
</para>
</td>
<td>
<para style="TITLES_NEW_">
<font></font>
</para>
</td>
<td> <td>
<para style="TITLES_NEW"> <para style="TITLES_NEW">
<font> [[ formatLang( m['date'], date=True) ]]</font>
<font></font>
</para> </para>
</td> </td>
<td>
<para style="TITLE_LEFT_ALIGN">
</para>
</td>
<td>
<para style="TITLE_LEFT_ALIGN">
</para>
</td>
<td>
<para style="TITLE_LEFT_ALIGN">
</para>
</td>
</tr>
</blockTable>
<section>
<para>[[ repeatIn(j.get('obj').line_id, 'k') ]]</para>
<blockTable colWidths="6.0cm,3.0cm,3.0cm,1.5cm,5.0cm,2.5cm,2.5cm,2.5cm" style="BODY_LINE" repeatRows="1">
<tr>
<td> <td>
<para style="TITLES_NEW"> <para style="TITLES_NEW">
<font>[[ m['period'] ]]</font>
<font> [[ k.name ]]</font>
</para> </para>
</td> </td>
<td> <td>
<para style="TITLES_NEW"> <para style="TITLES_NEW">
<font>[[ m['name'] ]] [[ m['ref'] and (' - Ref %s'%m['ref']) or '' ]] </font>
<font>[[ k.ref and k.ref or '']]</font>
</para> </para>
</td> </td>
<td> <td>
<para style="TITLES_NEW"> <para style="TITLES_NEW">
<font>[[ m['entry'] ]]</font>
<font>[[ k.partner_id and k.partner_id.name or '']]</font>
</para> </para>
<!--
</td>
<td>
<para style="TITLES_NEW"> <para style="TITLES_NEW">
<font>[[ m['journal'] ]]</font>
<font>[[ k.account_id and k.account_id.code or '']]</font>
</para> </para>
-->
</td> </td>
<td> <td>
<para style="TITLES_NEW"> <para style="TITLES_NEW">
<font>[[ m['partner'] ]]</font>
<font>[[ k.account_id and k.account_id.name or '']]</font>
</para> </para>
</td> </td>
<td> <td>
<para style="TITLE_LEFT_ALIGN">
<font>[[ a['type']&lt;&gt;'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font>
<font>[[ (a['total']==True) and formatLang(m['debit'], digits=2, grouping=True) or '']]</font>
<para style="TITLES_NEW_RIGHT">
<font>[[ k.type&lt;&gt;'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font>
<font>[[ k.debit and formatLang(k.debit, digits=2, grouping=True) or '' ]] </font>
</para> </para>
</td> </td>
<td> <td>
<para style="TITLE_LEFT_ALIGN">
<font>[[ a['type']&lt;&gt;'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font>
<font>[[ (a['total']==True) and formatLang(m['credit'], digits=2, grouping=True) or '']]</font>
<para style="TITLES_NEW_RIGHT">
<font>[[ k.type&lt;&gt;'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font>
<font>[[ k.credit and formatLang(k.credit, digits=2, grouping=True) or '' ]] </font>
</para> </para>
</td> </td>
<td> <td>
<para style="TITLE_LEFT_ALIGN">
<font>[[ a['type']&lt;&gt;'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font>
<font>[[ (a['total']==True) and formatLang(m['balance'] and m['balance'] * a.get('change_sign',1.0) or 0.0, digits=2, grouping=True) or '']]</font>
<para style="TITLES_NEW_RIGHT">
<font>[[ k.type&lt;&gt;'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font>
<font>[[ k.reconcile_id and k.reconcile_id.name or k.reconcile_partial_id and k.reconcile_partial_id.name or '']]</font>
</para> </para>
</td> </td>
</tr> </tr>
</blockTable> </blockTable>
</section> </section>
<spacer length="1.5mm"/>
</section>
<spacer length="2.5mm"/> <spacer length="2.5mm"/>
</section> </section>

42
account_financial_report/report/parser.py

@ -220,6 +220,46 @@ class account_balance(report_sxw.rml_parse):
}) })
return res return res
def _get_journal_ledger(self, account, ctx={}):
res = []
am_obj = self.pool.get('account.move')
print 'AM OBJ ', am_obj
if account['type'] in ('other', 'liquidity', 'receivable', 'payable'):
#~ TODO: CUANDO EL PERIODO ESTE VACIO LLENARLO CON LOS PERIODOS DEL EJERCICIO
#~ FISCAL, SIN LOS PERIODOS ESPECIALES
periods = ', '.join([str(i) for i in ctx['periods']])
#~ periods = str(tuple(ctx['periods']))
where = """where aml.period_id in (%s) and aa.id = %s and aml.state <> 'draft'""" % (
periods, account['id'])
if ctx.get('state','posted')=='posted':
where += "AND am.state = 'posted'"
sql_detalle = """SELECT
DISTINCT am.id as am_id,
aj.name as diario,
am.name as name,
am.date as date,
ap.name as periodo
from account_move_line aml
inner join account_journal aj on aj.id = aml.journal_id
inner join account_account aa on aa.id = aml.account_id
inner join account_period ap on ap.id = aml.period_id
inner join account_move am on am.id = aml.move_id """ + where +\
""" order by date, am.name"""
self.cr.execute(sql_detalle)
resultat = self.cr.dictfetchall()
for det in resultat:
res.append({
'am_id': det['am_id'],
'journal': det['diario'],
'name': det['name'],
'date': det['date'],
'period': det['periodo'],
'obj': am_obj.browse(self.cr,self.uid,det['am_id'])
})
print 'ACCOUNT NAME', am_obj.browse(self.cr,self.uid,det['am_id']).name
return res
def lines(self, form, level=0): def lines(self, form, level=0):
""" """
Returns all the data needed for the report lines Returns all the data needed for the report lines
@ -766,6 +806,8 @@ class account_balance(report_sxw.rml_parse):
#~ ANALYTIC LEDGER #~ ANALYTIC LEDGER
if to_include and form['analytic_ledger'] and form['columns'] == 'four' and form['inf_type'] == 'BS' and res['type'] in ('other', 'liquidity', 'receivable', 'payable'): if to_include and form['analytic_ledger'] and form['columns'] == 'four' and form['inf_type'] == 'BS' and res['type'] in ('other', 'liquidity', 'receivable', 'payable'):
res['mayor'] = self._get_analytic_ledger(res, ctx=ctx_end) res['mayor'] = self._get_analytic_ledger(res, ctx=ctx_end)
elif to_include and form['journal_ledger'] and form['columns'] == 'four' and form['inf_type'] == 'BS' and res['type'] in ('other', 'liquidity', 'receivable', 'payable'):
res['journal'] = self._get_journal_ledger(res, ctx=ctx_end)
else: else:
res['mayor'] = [] res['mayor'] = []

1
account_financial_report/view/wizard.xml

@ -43,7 +43,6 @@
/> />
<field name="journal_ledger" <field name="journal_ledger"
attrs="{'readonly':['|',('columns','!=','four'),('inf_type','!=','BS')],}" attrs="{'readonly':['|',('columns','!=','four'),('inf_type','!=','BS')],}"
on_change='onchange_journal_ledger(company_id,journal_ledger)'
/> />
</group> </group>
</group> </group>

Loading…
Cancel
Save