[FIX] fixed emails in multi currency + removed duplicated code

bzr revid: qdp-launchpad@openerp.com-20121206164706-o25nomraucn6pcxd
This commit is contained in:
Quentin (OpenERP)
2012-12-06 17:47:06 +01:00
parent 5beebee779
commit 73dd7ccacc
2 changed files with 3 additions and 39 deletions
+3 -3
View File
@@ -131,7 +131,7 @@ class email_template(osv.osv):
final_res = rml_parse._lines_get_with_partner(partner, company.id)
for currency_dict in final_res:
currency_symbol = currency_dict.get('line', [{'currency_id': company.currency_id}])[0]['currency_id'].symbol
currency = currency_dict.get('line', [{'currency_id': company.currency_id}])[0]['currency_id']
followup_table += '''
<table border="2" width=100%%>
<tr>
@@ -141,7 +141,7 @@ class email_template(osv.osv):
<td>Amount (%s)</td>
<td>Lit.</td>
</tr>
''' % (currency_symbol)
''' % (currency.symbol)
total = 0
for aml in currency_dict['line']:
block = aml['blocked'] and 'X' or ' '
@@ -153,7 +153,7 @@ class email_template(osv.osv):
strbegin = "<TD><B>"
strend = "</B></TD>"
followup_table +="<TR>" + strbegin + str(aml['date']) + strend + strbegin + aml['ref'] + strend + strbegin + str(date) + strend + strbegin + str(aml['balance']) + strend + strbegin + block + strend + "</TR>"
total = rml_parse.formatLang(total, dp='Account', currency_obj=partner.company_id.currency_id)
total = rml_parse.formatLang(total, dp='Account', currency_obj=currency)
followup_table += '''<tr> </tr>
</table>
<center>Amount due: %s </center>''' % (total)
@@ -81,42 +81,6 @@ class report_rappel(report_sxw.rml_parse):
final_res.append({'line': line_cur[cur]['line']})
return final_res
def get_unreconciled_table(self, partner, company, context = None):
final_res = self._lines_get_with_partner(partner, company.id)
followup_table = ''
for currency_dict in final_res:
currency = currency_dict.get('line', [{'currency_id': company.currency_id}])[0]['currency_id']
followup_table += '''
<table border="2" width=100%%>
<tr>
<td>Invoice date</td>
<td>Reference</td>
<td>Due date</td>
<td>Amount (%s)</td>
<td>Lit.</td>
</tr>
''' % (currency.symbol)
total = 0
ctx = context
for aml in currency_dict['line']:
block = aml['blocked'] and 'X' or ' '
total += aml['balance']
strbegin = "<TD>"
strend = "</TD>"
date = aml['date_maturity'] or aml['date']
if date <= ctx['current_date'] and aml['balance'] > 0:
strbegin = "<TD><B>"
strend = "</B></TD>"
followup_table +="<TR>" + strbegin + str(aml['date']) + strend + strbegin + \
aml['ref'] + strend + strbegin + str(date) + strend + strbegin + \
str(aml['balance']) + strend + strbegin + block + strend + "</TR>"
total = self.formatLang(total, dp='Account', currency_obj=currency)
followup_table += '''<tr> </tr>
</table>
<center>Amount due: %s </center>''' % (total)
return followup_table
def _get_text(self, stat_line, followup_id, context=None):
if context is None:
context = {}