[ADD][IMP] account: Added one row for with out partner recivable payable entry balance with some improvement in Aged Partner Balance Report.
bzr revid: vra@tinyerp.com-20100907055519-gggcdb2lgchp9682
This commit is contained in:
parent
42e8cd0749
commit
07ff80ca26
|
@ -34,6 +34,7 @@ class aged_trial_report(rml_parse.rml_parse, common_report_header):
|
|||
self.total_account = []
|
||||
self.localcontext.update({
|
||||
'time': time,
|
||||
'get_lines_with_out_partner': self._get_lines_with_out_partner,
|
||||
'get_lines': self._get_lines,
|
||||
'get_total': self._get_total,
|
||||
'get_direction': self._get_direction,
|
||||
|
@ -205,6 +206,113 @@ class aged_trial_report(rml_parse.rml_parse, common_report_header):
|
|||
totals[str(i)] += float(r[str(i)] or 0.0)
|
||||
return res
|
||||
|
||||
def _get_lines_with_out_partner(self, form):
|
||||
res = []
|
||||
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
|
||||
## mise a 0 du total
|
||||
for i in range(7):
|
||||
self.total_account.append(0)
|
||||
totals = {}
|
||||
self.cr.execute('SELECT SUM(debit-credit) \
|
||||
FROM account_move_line AS l, account_account\
|
||||
WHERE (l.account_id = account_account.id)\
|
||||
AND (l.partner_id IS NULL)\
|
||||
AND (account_account.type IN %s)\
|
||||
AND ((reconcile_id IS NULL) \
|
||||
OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\
|
||||
AND ' + self.query + '\
|
||||
AND account_account.active ' ,(tuple(self.ACCOUNT_TYPE), self.date_from, ))
|
||||
t = self.cr.fetchall()
|
||||
for i in t:
|
||||
totals['With out Partner'] = i[0]
|
||||
future_past = {}
|
||||
if self.direction_selection == 'future':
|
||||
self.cr.execute('SELECT SUM(debit-credit) \
|
||||
FROM account_move_line AS l, account_account\
|
||||
WHERE (l.account_id=account_account.id)\
|
||||
AND (l.partner_id IS NULL)\
|
||||
AND (account_account.type IN %s)\
|
||||
AND (COALESCE(date_maturity, date) < %s)\
|
||||
AND ((reconcile_id IS NULL)\
|
||||
OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\
|
||||
AND '+ self.query + '\
|
||||
AND account_account.active ', (tuple(self.ACCOUNT_TYPE), self.date_from, self.date_from, ))
|
||||
t = self.cr.fetchall()
|
||||
for i in t:
|
||||
future_past['With out Partner'] = i[0]
|
||||
elif self.direction_selection == 'past': # Using elif so people could extend without this breaking
|
||||
self.cr.execute('SELECT SUM(debit-credit) \
|
||||
FROM account_move_line AS l, account_account\
|
||||
WHERE (l.account_id=account_account.id)\
|
||||
AND (l.partner_id IS NULL)\
|
||||
AND (account_account.type IN %s)\
|
||||
AND (COALESCE(date_maturity,date) > %s)\
|
||||
AND ((reconcile_id IS NULL)\
|
||||
OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\
|
||||
AND '+ self.query + '\
|
||||
AND account_account.active ' , (tuple(self.ACCOUNT_TYPE), self.date_from, self.date_from,))
|
||||
t = self.cr.fetchall()
|
||||
for i in t:
|
||||
future_past['With out Partner'] = i[0]
|
||||
history = []
|
||||
for i in range(5):
|
||||
self.cr.execute('SELECT SUM(debit-credit)\
|
||||
FROM account_move_line AS l, account_account\
|
||||
WHERE (l.account_id = account_account.id)\
|
||||
AND (l.partner_id IS NULL)\
|
||||
AND (account_account.type IN %s)\
|
||||
AND (COALESCE(date_maturity,date) BETWEEN %s AND %s)\
|
||||
AND ((reconcile_id IS NULL)\
|
||||
OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\
|
||||
AND '+ self.query + '\
|
||||
AND account_account.active ' , (tuple(self.ACCOUNT_TYPE), form[str(i)]['start'], form[str(i)]['stop'], self.date_from,))
|
||||
t = self.cr.fetchall()
|
||||
d = {}
|
||||
for i in t:
|
||||
d['With out Partner'] = i[0]
|
||||
history.append(d)
|
||||
|
||||
values = {}
|
||||
if self.direction_selection == 'future':
|
||||
before = False
|
||||
if future_past.has_key('With out Partner'):
|
||||
before = [ future_past['With out Partner'] ]
|
||||
self.total_account[6] = self.total_account[6] + (before and before[0] or 0.0)
|
||||
values['direction'] = before and before[0] or 0.0
|
||||
elif self.direction_selection == 'past':
|
||||
after = False
|
||||
if future_past.has_key('With out Partner'):
|
||||
after = [ future_past['With out Partner'] ]
|
||||
self.total_account[6] = self.total_account[6] + (after and after[0] or 0.0)
|
||||
values['direction'] = after and after[0] or ""
|
||||
|
||||
for i in range(5):
|
||||
during = False
|
||||
if history[i].has_key('With out Partner'):
|
||||
during = [ history[i]['With out Partner'] ]
|
||||
self.total_account[(i)] = self.total_account[(i)] + (during and during[0] or 0)
|
||||
values[str(i)] = during and during[0] or ""
|
||||
|
||||
total = False
|
||||
if totals.has_key( 'With out Partner' ):
|
||||
total = [ totals['With out Partner'] ]
|
||||
values['total'] = total and total[0] or 0.0
|
||||
## Add for total
|
||||
self.total_account[(i+1)] = self.total_account[(i+1)] + (total and total[0] or 0.0)
|
||||
values['name'] = 'With out Partner'
|
||||
|
||||
if values['total']:
|
||||
res.append(values)
|
||||
|
||||
total = 0.0
|
||||
totals = {}
|
||||
for r in res:
|
||||
total += float(r['total'] or 0.0)
|
||||
for i in range(5)+['direction']:
|
||||
totals.setdefault(str(i), 0.0)
|
||||
totals[str(i)] += float(r[str(i)] or 0.0)
|
||||
return res
|
||||
|
||||
def _get_total(self,pos):
|
||||
period = self.total_account[int(pos)]
|
||||
return period
|
||||
|
|
|
@ -40,33 +40,10 @@
|
|||
<blockTableStyle id="Table8">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="0,0" stop="0,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,0" stop="0,0"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,0" stop="1,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,0" stop="1,0"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="2,0" stop="2,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="2,0" stop="2,0"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="3,0" stop="3,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="3,0" stop="3,0"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="4,0" stop="4,-1"/>
|
||||
<lineStyle kind="LINEAFTER" colorName="#cccccc" start="4,0" stop="4,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="4,0" stop="4,0"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="0,1" stop="0,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,1" stop="0,1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,1" stop="1,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,1" stop="1,1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="2,1" stop="2,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="2,1" stop="2,1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,-1" stop="2,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="3,1" stop="3,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="3,1" stop="3,1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="3,-1" stop="3,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="4,1" stop="4,-1"/>
|
||||
<lineStyle kind="LINEAFTER" colorName="#cccccc" start="4,1" stop="4,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="4,1" stop="4,1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="4,-1" stop="4,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#cccccc" start="0,0" stop="-1,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,0" stop="-1,-1"/>
|
||||
<lineStyle kind="LINEAFTER" colorName="#cccccc" start="0,0" stop="-1,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,0" stop="-1,-1"/>
|
||||
</blockTableStyle>
|
||||
|
||||
<blockTableStyle id="Tableau3">
|
||||
|
@ -104,10 +81,10 @@
|
|||
<paraStyle name="Table Heading" fontName="Helvetica" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Caption" fontName="Helvetica" fontSize="8.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Index" fontName="Helvetica"/>
|
||||
<paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="terp_default_Centre_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="terp_header_Centre" fontName="Helvetica-Bold" fontSize="15.0" leading="15" alignment="CENTER" spaceBefore="12.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="terp_default_Centre_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="terp_header_Centre" fontName="Helvetica-Bold" fontSize="15.0" leading="15" alignment="CENTER" spaceBefore="12.0" spaceAfter="6.0"/>
|
||||
</stylesheet>
|
||||
<story>
|
||||
<para style="P9">
|
||||
|
@ -121,7 +98,7 @@
|
|||
<td><para style="terp_header"><font color="white"> </font></para></td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<blockTable colWidths="200.0,200.0,200.0,219.0,200.0" style="Table8">
|
||||
<blockTable colWidths="200.0,200.0,100.0,100.0,119.0,100.0,200.0" style="Table8">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_tblheader_General_Centre">Chart of Account</para>
|
||||
|
@ -132,14 +109,20 @@
|
|||
<td>
|
||||
<para style="terp_tblheader_General_Centre">Start Date</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_General_Centre">Period Length(days)</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_General_Centre">Partner's</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_General_Centre">Analysis Direction</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_General_Centre">Printing Date</para>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_default_Centre_8">[[ get_account(data) or '' ]]</para>
|
||||
</td>
|
||||
|
@ -149,15 +132,21 @@
|
|||
<td>
|
||||
<para style="terp_default_Centre_8">[[ data['form']['date_from'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Centre_8">[[ data['form']['period_length'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Centre_8">[[ get_partners(data) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Centre_8">[[ data['form']['direction_selection'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Centre_8">[[ formatLang(time.strftime('%Y-%m-%d %H:%M:%S'), date_time = True)]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="P9">
|
||||
<para style="P9">
|
||||
<font color="white"> </font>
|
||||
</para> <para style="P9">
|
||||
<font color="white"> </font>
|
||||
|
@ -194,6 +183,7 @@
|
|||
|
||||
<td>
|
||||
<para style="P3"> <font color="white">[[ (get_lines(data['form']), 'partner') == False or removeParentNode('para') ]]</font></para>
|
||||
<para style="P3"> <font color="white">[[ (get_lines_with_out_partner(data['form']), 'not_partner') == False or removeParentNode('para') ]]</font></para>
|
||||
<para style="P9"><font color="white"> </font></para>
|
||||
<para style="Total">Account Total</para>
|
||||
</td>
|
||||
|
@ -254,6 +244,33 @@
|
|||
<para style="content">[[ formatLang(partner['total'] or 0.00 ) ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P3">[[ repeatIn(get_lines_with_out_partner(data['form']), 'not_partner') ]]</para>
|
||||
<para style="P2_content">[[ not_partner['name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="content">[[ formatLang(not_partner['direction'] or 0.00) ]] </para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="content">[[ formatLang(not_partner['4'] or 0.00)]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="content">[[ formatLang(not_partner['3'] or 0.00)]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="content">[[ formatLang(not_partner['2'] or 0.00) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="content">[[ formatLang(not_partner['1'] or 0.00) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="content">[[ formatLang(not_partner['0'] or 0.00) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="content">[[ formatLang(not_partner['total'] or 0.00 ) ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
|
||||
<para style="P9">
|
||||
|
|
Loading…
Reference in New Issue