[IMP]:Account:multi currency report feature improvement(send follow ups)
bzr revid: ron@tinyerp.com-20110322111023-d3phue8nql33gdwr
This commit is contained in:
@@ -50,13 +50,45 @@ class report_rappel(report_sxw.rml_parse):
|
||||
return adr and res_partner_address.read(self.cr, self.uid, [adr]) or [{}]
|
||||
|
||||
def _lines_get(self, partner):
|
||||
moveline_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
|
||||
pool = pooler.get_pool(self.cr.dbname)
|
||||
moveline_obj = pool.get('account.move.line')
|
||||
company_obj = pool.get('res.company')
|
||||
obj_currency = pool.get('res.currency')
|
||||
movelines = moveline_obj.search(self.cr, self.uid,
|
||||
[('partner_id', '=', partner.id),
|
||||
('account_id.type', '=', 'receivable'),
|
||||
('reconcile_id', '=', False), ('state', '<>', 'draft')])
|
||||
movelines = moveline_obj.read(self.cr, self.uid, movelines)
|
||||
return movelines
|
||||
movelines = moveline_obj.browse(self.cr, self.uid, movelines)
|
||||
base_currency = movelines[0].company_id.currency_id
|
||||
final_res = []
|
||||
line_cur = {base_currency.id: {'line': []}}
|
||||
|
||||
for line in movelines:
|
||||
if line.currency_id and (not line.currency_id.id in line_cur):
|
||||
line_cur[line.currency_id.id] = {'line': []}
|
||||
line_data = {
|
||||
'name': line.name + (line.currency_id and line.currency_id.name or ''),
|
||||
'ref': line.ref,
|
||||
'date':line.date,
|
||||
'date_maturity': line.date_maturity,
|
||||
'amount_currency': line.amount_currency,
|
||||
'blocked': line.blocked,
|
||||
'debit': line.debit ,
|
||||
'credit': line.credit,
|
||||
}
|
||||
if line.currency_id:
|
||||
rate = obj_currency._get_conversion_rate(self.cr, self.uid, line.company_id.currency_id, line.currency_id)
|
||||
line_data['debit'] = line.debit * rate
|
||||
line_data['credit'] = line.credit * rate
|
||||
line_data.update({'currency_id':line.currency_id.symbol or line.currency_id.name or ''})
|
||||
line_cur[line.currency_id.id]['line'].append(line_data)
|
||||
else:
|
||||
line_data.update({'currency_id':line.company_id.currency_id.symbol or line.currency_id.name or ''})
|
||||
line_cur[base_currency.id]['line'].append(line_data)
|
||||
for cur in line_cur:
|
||||
final_res.append({'line': line_cur[cur]['line']})
|
||||
return final_res
|
||||
|
||||
|
||||
def _get_text(self, partner, followup_id, context=None):
|
||||
fp_obj = pooler.get_pool(self.cr.dbname).get('account_followup.followup')
|
||||
|
||||
@@ -94,6 +94,7 @@
|
||||
<story>
|
||||
<para style="terp_default_8">[[ repeatIn(ids_to_objects(data['form']['partner_ids']),'o') ]] </para>
|
||||
<para style="terp_default_8">[[ setLang(o.lang) ]]</para>
|
||||
|
||||
<blockTable colWidths="298.0,234.0" style="Tableau2">
|
||||
<tr>
|
||||
<td>
|
||||
@@ -126,7 +127,10 @@
|
||||
<para style="terp_default_9">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="66.0,77.0,46.0,74.0,52.0,62.0,59.0,67.0,29.0" style="Table1">
|
||||
<section>
|
||||
|
||||
<blockTable colWidths="63.0,50.0,46.0,62.0,77.0,77.0,80.0,29.0" style="Table1">
|
||||
<para style="terp_default_8">[[repeatIn(getLines(o), 'cur_lines') ]]</para>
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Centre">Invoice Date</para>
|
||||
@@ -140,9 +144,6 @@
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Centre">Maturity Date</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Right">Currency</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Right">Due</para>
|
||||
</td>
|
||||
@@ -156,11 +157,8 @@
|
||||
<para style="terp_tblheader_Details_Centre">Li.</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<section>
|
||||
<para style="terp_default_8">[[repeatIn(getLines(o), 'line') ]]</para>
|
||||
<blockTable colWidths="66.0,78.0,46.0,69.0,57.0,62.0,58.0,68.0,28.0" style="Table5">
|
||||
<tr>
|
||||
<tr>
|
||||
<para style="terp_default_8">[[repeatIn(cur_lines['line'], 'line') ]]</para>
|
||||
<td>
|
||||
<para style="terp_default_9">[[ formatLang(line['date'],date = True) ]]</para>
|
||||
</td>
|
||||
@@ -174,24 +172,20 @@
|
||||
<para style="terp_default_Centre_9">[[ line['date_maturity'] and formatLang(line['date_maturity'], date=True) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_9">[[ formatLang(line['amount_currency'] )]] [[ line['amount_currency'] and line['currency_id'][1] or '' ]] </para>
|
||||
<para style="terp_default_Right_9">[[ formatLang(line['debit']) ]] [[ line['currency_id'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_9">[[ formatLang(line['debit']) ]] </para>
|
||||
<para style="terp_default_Right_9">[[ formatLang(line['credit']) ]] [[ line['currency_id'] ]] </para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_9">[[ formatLang(line['credit']) ]] </para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_9">[[ (line['date_maturity'] < time.strftime('%Y-%m-%d')) and formatLang(line['debit'] -line['credit']) or formatLang(0.0) ]] [[ company.currency_id.symbol ]]</para>
|
||||
<para style="terp_default_Right_9">[[ (line['date_maturity'] < time.strftime('%Y-%m-%d')) and formatLang(line['debit'] -line['credit']) or formatLang(0.0) ]] [[ line['currency_id'] or '']]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Centre_9">[[ line['blocked'] and 'X' or '' ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
</section>
|
||||
<blockTable colWidths="190.0,101.0,87.0,58.0,68.0,28.0" style="Table2">
|
||||
<blockTable colWidths="160.0,57.0,80.0,80.0,80.0,28.0" style="Table2">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_default_8">
|
||||
@@ -202,13 +196,13 @@
|
||||
<para style="terp_tblheader_Details">Sub-Total: </para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_9">[[formatLang(reduce(lambda x,y: x+y['debit'], getLines(o), 0.00)) ]] </para>
|
||||
<para style="terp_default_Right_9">[[formatLang(reduce(lambda x,y: x+y['debit'], cur_lines['line'], 0.00)) ]] [[ line['currency_id'] ]] </para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_9">[[formatLang(reduce(lambda x,y: x+y['credit'], getLines(o), 0.00)) ]] </para>
|
||||
<para style="terp_default_Right_9">[[formatLang(reduce(lambda x,y: x+y['credit'], cur_lines['line'], 0.00)) ]] [[ line['currency_id'] ]] </para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_9">[[ formatLang(reduce(lambda x,y: x+(y['debit'] - y['credit']), filter(lambda x: x['date_maturity'] < time.strftime('%Y-%m-%d'), getLines(o)), 0)) ]] [[ company.currency_id.symbol ]]</para>
|
||||
<para style="terp_default_Right_9">[[ formatLang(reduce(lambda x,y: x+(y['debit'] - y['credit']), filter(lambda x: x['date_maturity'] < time.strftime('%Y-%m-%d'), cur_lines['line']), 0)) ]] [[ line['currency_id'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_9">
|
||||
@@ -217,7 +211,7 @@
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<blockTable colWidths="193.0,92.0,100.0,147.0" style="Table3">
|
||||
<blockTable colWidths="160.0,57.0,80.0,80.0,80.0,28.0" style="Table2">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_default_8">
|
||||
@@ -228,14 +222,41 @@
|
||||
<para style="terp_tblheader_Details">Balance: </para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_Details_Right">[[ formatLang((reduce(lambda x,y: x+(y['debit'] - y['credit']), getLines(o), 0.00))) ]] [[ company.currency_id.symbol]] </para>
|
||||
|
||||
<para style="terp_tblheader_Details_Centre">[[ formatLang((reduce(lambda x,y: x+(y['debit'] - y['credit']), cur_lines['line'], 0.00))) ]] [[line['currency_id'] ]] </para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_8">
|
||||
<font color="white"></font>
|
||||
</para>
|
||||
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_8">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<para style="terp_default_8">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="terp_default_8">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="terp_default_8">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="terp_default_8">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
|
||||
</section>
|
||||
|
||||
</story>
|
||||
</document>
|
||||
</document>
|
||||
|
||||
Reference in New Issue
Block a user