summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorQuentin (OpenERP) <qdp-launchpad@openerp.com>2011-03-23 15:43:41 +0100
committerQuentin (OpenERP) <qdp-launchpad@openerp.com>2011-03-23 15:43:41 +0100
commitcf33670162f1beeae7feb643ea9bddc604ff7ea4 (patch)
tree3f698dc90ab59bb17920c340fefafe0f2ffcbe9e /addons
parent33ad8a8ad911c92302be4773669d3a0ee5eb51f2 (diff)
[FIX][IMP] account_followup: improved the layout and overal shape of report + fixed the way to display amount in currency other than company (should use amount_currency field instead of (debit-credit * rate))
bzr revid: qdp-launchpad@openerp.com-20110323144341-425n7h1rkrpj4s1s
Diffstat (limited to 'addons')
-rw-r--r--addons/account_followup/report/account_followup_print.py22
-rw-r--r--addons/account_followup/report/account_followup_print.rml64
2 files changed, 14 insertions, 72 deletions
diff --git a/addons/account_followup/report/account_followup_print.py b/addons/account_followup/report/account_followup_print.py
index c2818c886f2..9ad0e4bd480 100644
--- a/addons/account_followup/report/account_followup_print.py
+++ b/addons/account_followup/report/account_followup_print.py
@@ -54,6 +54,7 @@ class report_rappel(report_sxw.rml_parse):
moveline_obj = pool.get('account.move.line')
company_obj = pool.get('res.company')
obj_currency = pool.get('res.currency')
+ #FIXME: search on company accounting entries only
movelines = moveline_obj.search(self.cr, self.uid,
[('partner_id', '=', partner.id),
('account_id.type', '=', 'receivable'),
@@ -62,29 +63,22 @@ class report_rappel(report_sxw.rml_parse):
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': []}
+ currency = line.currency_id or line.company_id.currency_id
line_data = {
- 'name': line.name + (line.currency_id and line.currency_id.name or ''),
+ 'name': line.name,
'ref': line.ref,
'date':line.date,
'date_maturity': line.date_maturity,
- 'amount_currency': line.amount_currency,
+ 'balance': line.currency_id and line.amount_currency or (line.debit - line.credit),
'blocked': line.blocked,
- 'debit': line.debit ,
- 'credit': line.credit,
+ 'currency_id': currency.symbol or currency.name,
}
- 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)
+ line_cur[currency.id]['line'].append(line_data)
+
for cur in line_cur:
final_res.append({'line': line_cur[cur]['line']})
return final_res
diff --git a/addons/account_followup/report/account_followup_print.rml b/addons/account_followup/report/account_followup_print.rml
index be8ab854fe7..dd4aefb39e5 100644
--- a/addons/account_followup/report/account_followup_print.rml
+++ b/addons/account_followup/report/account_followup_print.rml
@@ -129,7 +129,7 @@
</para>
<section>
- <blockTable colWidths="63.0,50.0,46.0,62.0,77.0,77.0,80.0,29.0" style="Table1">
+ <blockTable colWidths="70.0,100.0,89.0,70.0,89.0,29.0" style="Table1">
<para style="terp_default_8">[[repeatIn(getLines(o), 'cur_lines') ]]</para>
<tr>
<td>
@@ -145,13 +145,7 @@
<para style="terp_tblheader_Details_Centre">Maturity Date</para>
</td>
<td>
- <para style="terp_tblheader_Details_Right">Due</para>
- </td>
- <td>
- <para style="terp_tblheader_Details_Right">Paid</para>
- </td>
- <td>
- <para style="terp_tblheader_Details_Right">Maturity</para>
+ <para style="terp_tblheader_Details_Right">Amount</para>
</td>
<td>
<para style="terp_tblheader_Details_Centre">Li.</para>
@@ -172,20 +166,14 @@
<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['debit']) ]] [[ line['currency_id'] ]]</para>
- </td>
- <td>
- <para style="terp_default_Right_9">[[ formatLang(line['credit']) ]] [[ line['currency_id'] ]] </para>
- </td>
- <td>
- <para style="terp_default_Right_9">[[ (line['date_maturity'] &lt; time.strftime('%Y-%m-%d')) and formatLang(line['debit'] -line['credit']) or formatLang(0.0) ]] [[ line['currency_id'] or '']]</para>
+ <para style="terp_default_Right_9">[[ formatLang(line['balance']) ]] [[ line['currency_id'] ]]</para>
</td>
<td>
<para style="terp_default_Centre_9">[[ line['blocked'] and 'X' or '' ]]</para>
</td>
</tr>
</blockTable>
- <blockTable colWidths="160.0,57.0,80.0,80.0,80.0,28.0" style="Table2">
+ <blockTable colWidths="260.0,70.0,89.0,29.0" style="Table2">
<tr>
<td>
<para style="terp_default_8">
@@ -193,16 +181,10 @@
</para>
</td>
<td>
- <para style="terp_tblheader_Details">Sub-Total: </para>
+ <para style="terp_tblheader_Details">Total: </para>
</td>
<td>
- <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'], 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'] &lt; time.strftime('%Y-%m-%d'), cur_lines['line']), 0)) ]] [[ line['currency_id'] ]]</para>
+ <para style="terp_default_Right_9">[[formatLang(reduce(lambda x,y: x+y['balance'], cur_lines['line'], 0.00)) ]] [[ line['currency_id'] ]] </para>
</td>
<td>
<para style="terp_default_Right_9">
@@ -211,41 +193,7 @@
</td>
</tr>
</blockTable>
- <blockTable colWidths="160.0,57.0,80.0,80.0,80.0,28.0" style="Table2">
- <tr>
- <td>
- <para style="terp_default_8">
- <font color="white"> </font>
- </para>
- </td>
- <td>
- <para style="terp_tblheader_Details">Balance: </para>
- </td>
- <td>
- <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>