=== modified file 'account_payment/report/order.rml' --- account_payment/report/order.rml 2009-06-18 04:14:03 +0000 +++ account_payment/report/order.rml 2010-08-12 09:00:38 +0000 @@ -14,6 +14,10 @@ + + + + @@ -22,6 +26,7 @@ + @@ -31,11 +36,23 @@ + + + + + + + + + + + - + + @@ -68,8 +85,8 @@ + - [[ repeatIn(objects, 'o') ]] @@ -98,16 +115,82 @@ - [[ o.mode and o.mode.name ]] - - - - Reference: [[ o.reference ]] - Execution date: [[ o.date_done or '/']] - - - - + Payment Order / Payment + + + + + + + Payment Type + + + [[ o.mode and o.mode.name or '-' ]] + + + + + Reference + + + [[ o.reference or '-' ]] + + + + + Used Account + + + [[ o.mode.bank_id.name or '-' ]] + + + + + Execution Type + + + [[ o.date_prefered == 'now' and 'Now' or removeParentNode('para') ]] + [[ o.date_prefered == 'due' and 'Due date' or removeParentNode('para') ]] + [[ o.date_prefered == 'fixed' and 'Fixed date' or removeParentNode('para') ]] + + + + + Company Currency + + + [[ get_company_currency() ]] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Partner @@ -116,14 +199,17 @@ Bank account - Reference + Invoice reference - Date + Value date Amount + + Amount in currency + @@ -131,19 +217,22 @@
[[repeatIn(o.line_ids, 'line') ]] - + - [[ line.partner_id and line.partner_id.name or '' ]] - - - [[ line.bank_id and line.bank_id.name ]] - - - [[ line.name ]] - - - [[ line.date ]] + [[line.partner_id and line.partner_id.name or '-' ]] + + + [[ line.bank_id and line.bank_id.name or '-' ]] + + + [[ get_invoice_name(line.ml_inv_ref.id) or '-' ]] + + + [[line.date=='False' and '-' or line.date ]] + + + [[formatLang(line.amount) or '-' ]] [[ formatLang(line.amount_currency) ]] [[ line.currency.name ]] @@ -154,8 +243,38 @@
- + + + + + + + + + + + + + + + + + + + + Total: + + + [[ formatLang(get_amount_total(o)) or '' ]] + + + [[ formatLang(get_amount_total_in_currency(o)) or '' ]] [[ get_amount_total_in_currency(o) and line.currency.name ]] + + + +
+ === modified file 'account_payment/report/payment_order.py' --- account_payment/report/payment_order.py 2009-10-09 11:49:00 +0000 +++ account_payment/report/payment_order.py 2010-08-12 08:38:17 +0000 @@ -22,6 +22,7 @@ import time import datetime +import pooler from report import report_sxw class payment_order(report_sxw.rml_parse): @@ -29,8 +30,54 @@ super(payment_order, self).__init__(cr, uid, name, context=context) self.localcontext.update( { 'time': time, - + 'get_invoice_name': self._get_invoice_name, + 'get_company_currency' : self._get_company_currency, + 'get_amount_total_in_currency' : self._get_amount_total_in_currency, + 'get_amount_total' : self._get_amount_total, }) + def _get_invoice_name(self,invoice_id): + if invoice_id: + pool = pooler.get_pool(self.cr.dbname) + value_name = pool.get('account.invoice').name_get(self.cr, self.uid, [invoice_id]) + if value_name: + return value_name[0][1] + else: + return False + else: + return False + def _get_amount_total_in_currency(self,payment): + total = 0.0 + if payment.line_ids: + currency_cmp = payment.line_ids[0].currency.id + else: + return False + for line in payment.line_ids: + if currency_cmp == line.currency.id: + total = total + line.amount_currency + else: + return False + return total + + def _get_amount_total(self,payment): + total = 0.0 + if not payment.line_ids: + return False + for line in payment.line_ids: + total = total + line.amount + return total + + + def _get_company_currency(self): + pool = pooler.get_pool(self.cr.dbname) + user = pool.get('res.users').browse(self.cr, self.uid, self.uid) + return user.company_id and user.company_id.currency_id and user.company_id.currency_id.name or False + + def _get_company_currency(self): + pool = pooler.get_pool(self.cr.dbname) + user = pool.get('res.users').browse(self.cr, self.uid, self.uid) + return user.company_id and user.company_id.currency_id and user.company_id.currency_id.name or False + + report_sxw.report_sxw('report.payment.order', 'payment.order', 'addons/account_payment/report/payment_order.rml', parser=payment_order,header=False) # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: