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 @@
- + [[repeatIn(getLines(o), 'cur_lines') ]] @@ -145,13 +145,7 @@ Maturity Date - Due - - - Paid - - - Maturity + Amount Li. @@ -172,20 +166,14 @@ [[ line['date_maturity'] and formatLang(line['date_maturity'], date=True) ]] - [[ formatLang(line['debit']) ]] [[ line['currency_id'] ]] - - - [[ formatLang(line['credit']) ]] [[ line['currency_id'] ]] - - - [[ (line['date_maturity'] < time.strftime('%Y-%m-%d')) and formatLang(line['debit'] -line['credit']) or formatLang(0.0) ]] [[ line['currency_id'] or '']] + [[ formatLang(line['balance']) ]] [[ line['currency_id'] ]] [[ line['blocked'] and 'X' or '' ]] - + @@ -193,16 +181,10 @@ - Sub-Total: + Total: - [[formatLang(reduce(lambda x,y: x+y['debit'], cur_lines['line'], 0.00)) ]] [[ line['currency_id'] ]] - - - [[formatLang(reduce(lambda x,y: x+y['credit'], cur_lines['line'], 0.00)) ]] [[ line['currency_id'] ]] - - - [[ 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'] ]] + [[formatLang(reduce(lambda x,y: x+y['balance'], cur_lines['line'], 0.00)) ]] [[ line['currency_id'] ]] @@ -211,41 +193,7 @@ - - - - - - - - - Balance: - - - [[ formatLang((reduce(lambda x,y: x+(y['debit'] - y['credit']), cur_lines['line'], 0.00))) ]] [[line['currency_id'] ]] - - - - - - - - - - - - - - - - - - - - - -