From 2a527ec0a0669b7af380e2184ceb9234b8151cee Mon Sep 17 00:00:00 2001 From: ced <> Date: Tue, 27 Nov 2007 15:43:54 +0000 Subject: [PATCH] Fix overdue report for refund line bzr revid: ced-77a5ffb4323dfa3c2550c49efb4d1d70d7663e98 --- addons/account/report/overdue.py | 2 +- addons/account/report/overdue.rml | 235 +++++++++++++++++++++++++++++- 2 files changed, 235 insertions(+), 2 deletions(-) diff --git a/addons/account/report/overdue.py b/addons/account/report/overdue.py index de430fd68ac..1d790e40b84 100644 --- a/addons/account/report/overdue.py +++ b/addons/account/report/overdue.py @@ -56,7 +56,7 @@ class Overdue(report_sxw.rml_parse): [('partner_id', '=', partner.id), ('account_id.type', 'in', ['receivable', 'payable']), ('state', '<>', 'draft'), ('reconcile_id', '=', False)]) - movelines = moveline_obj.read(self.cr, self.uid, movelines) + movelines = moveline_obj.browse(self.cr, self.uid, movelines) return movelines report_sxw.report_sxw('report.account.overdue', 'res.partner', diff --git a/addons/account/report/overdue.rml b/addons/account/report/overdue.rml index 8f1d0226dc7..fc6dde92f50 100644 --- a/addons/account/report/overdue.rml +++ b/addons/account/report/overdue.rml @@ -1,3 +1,236 @@ -[[ repeatIn(objects,'o') ]][[ setLang(o.lang) ]] [[ o.name ]][[ adr_get(o, 'invoice')['name'] ]][[ adr_get(o, 'invoice')['street'] ]][[ adr_get(o, 'invoice')['zip'] ]] [[ adr_get(o, 'invoice')['city'] ]][[ adr_get(o, 'invoice')['country_id'] and adr_get(o, 'invoice')['country_id'][1] ]] VAT: [[ o.vat or removeParentNode('para') ]] Document: Customer account statementDate: [[ time.strftime('%d/%m/%Y') ]]Customer Ref: [[ o.id ]] Dear Sir/Madam, Exception made of a mistake of our side, it seems that the following bills stay unpaid. Please, take appropriate measures in order to carry out this payment in the next 8 days. Would your payment have been carried out after this mail was sent, please consider the present one as void. Do not hesitate to contact our accounting departement at +32 81 81 37 00. Best regards. DateDescriptionRefMaturity dateDuePaidMaturityLi.[[repeatIn(getLines(o), 'line') ]] [[ line['date'] ]][[ line['name'] ]][[ line['ref'] ]][[ line['date_maturity'] ]][[ line['debit'] and '%.2f' % line['debit'] or '' ]][[ line['credit'] and '%.2f' % line['credit'] or '' ]][[ (line['date_maturity'] < time.strftime('%Y-%m-%d')) and (line['debit'] - line['credit']) or '' ]][[ line['blocked'] and 'X' or '' ]]Sub-Total: [[ '%.2f' % (reduce(lambda x,y: x+y['debit'], getLines(o), 0)) ]][[ '%.2f' % (reduce(lambda x,y: x+y['credit'], getLines(o), 0)) ]][[ reduce(lambda x,y: x+(y['debit'] - y['credit']), filter(lambda x: x['date_maturity'] < time.strftime('%Y-%m-%d'), getLines(o)), 0) ]] Balance: [[ '%.2f' % (reduce(lambda x,y: x+(y['debit'] - y['credit']), getLines(o), 0)) ]] Total amount due: [[ '%.2f' % (reduce(lambda x,y: x+(y['debit']-y['credit']), getLines(o), 0)) ]] [[ company.currency_id.name ]]. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [[ repeatIn(objects,'o') ]] + [[ setLang(o.lang) ]] + + + + + + + + + [[ o.name ]] + [[ adr_get(o, 'invoice')['name'] ]] + [[ adr_get(o, 'invoice')['street'] ]] + [[ adr_get(o, 'invoice')['zip'] ]] [[ adr_get(o, 'invoice')['city'] ]] + [[ adr_get(o, 'invoice')['country_id'] and adr_get(o, 'invoice')['country_id'][1] ]] + + + + VAT: [[ o.vat or removeParentNode('para') ]] + + + + + + + + + + Document: Customer account statement + + Date: + [[ time.strftime('%d/%m/%Y') ]] + + Customer Ref: [[ o.id ]] + + + + Dear Sir/Madam, + + + + Exception made of a mistake of our side, it seems that the following bills stay unpaid. Please, take appropriate measures in order to carry out this payment in the next 8 days. + + + + Would your payment have been carried out after this mail was sent, please consider the present one as void. Do not hesitate to contact our accounting departement at +32 81 81 37 00. + + + + Best regards. + + + + + + + Date + + + Description + + + Ref + + + Maturity date + + + Due + + + Paid + + + Maturity + + + Li. + + + + + + [[repeatIn(getLines(o), 'line') ]] + [[ line['date'] ]] + + + + [[ line['name'] ]] + + + [[ line['ref'] ]] + + + [[ line['date_maturity'] ]] + + + [[ line['debit'] and '%.2f' % (line['debit'] * (line['account_id']['type'] == 'payable' and -1 or 1)) or '' ]] + + + [[ line['credit'] and '%.2f' % (line['credit'] * (line['account_id']['type'] == 'payable' and -1 or 1)) or '' ]] + + + [[ (line['date_maturity'] < time.strftime('%Y-%m-%d')) and '%.2f' % ((line['debit'] - line['credit']) * (line['account_id']['type'] == 'payable' and -1 or 1)) or '' ]] + + + [[ line['blocked'] and 'X' or '' ]] + + + + + + + Sub-Total: + + + [[ '%.2f' % (reduce(lambda x, y: x + (y['debit'] * (y['account_id']['type'] == 'payable' and -1 or 1)), getLines(o), 0)) ]] + + + + [[ '%.2f' % (reduce(lambda x ,y: x + (y['credit'] * (y['account_id']['type'] == 'payable' and -1 or 1)), getLines(o), 0)) ]] + + + + [[ '%.2f' % (reduce(lambda x, y: x + ((y['debit'] - y['credit']) * (y['account_id']['type'] == 'payable' and -1 or 1)), filter(lambda x: x['date_maturity'] < time.strftime('%Y-%m-%d'), getLines(o)), 0)) ]] + + + + + + + + + + Balance: + + + [[ '%.2f' % (reduce(lambda x, y: x +((y['debit'] - y['credit']) * (y['account_id']['type'] == 'payable' and -1 or 1)), getLines(o), 0)) ]] + + + + + + + + + + + + + + + + + + + + + + + Total amount due: + [[ '%.2f' % (reduce(lambda x, y: x + ((y['debit'] - y['credit']) * (y['account_id']['type'] == 'payable' and -1 or 1)), getLines(o), 0)) ]] [[ company.currency_id.name ]]. + + + + + +