- [[ line.partner_id and line.partner_id.name or '' ]]
+ [[line.partner_id and line.partner_id.name or '-' ]]
|
- [[ line.bank_id and line.bank_id.name ]]
+ [[ line.bank_id and line.bank_id.name or '-' ]]
|
- [[ line.name ]]
+ [[ get_invoice_name(line.ml_inv_ref.id) or '-' ]]
|
- [[ line.date ]]
+ [[line.date=='False' and '-' or line.date ]]
+ |
+
+ [[formatLang(line.amount) or '-' ]]
|
[[ formatLang(line.amount_currency) ]] [[ line.currency.name ]]
@@ -154,7 +243,36 @@
-
+
+
+
+
+
+
+
+ |
+
+
+
+
+ |
+
+
+
+
+ |
+
+ 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 ]]
+ |
+
+
+
diff --git a/addons/account_payment/report/payment_order.py b/addons/account_payment/report/payment_order.py
index 9bbf32afc26..a3c102b6897 100644
--- a/addons/account_payment/report/payment_order.py
+++ b/addons/account_payment/report/payment_order.py
@@ -21,15 +21,55 @@
import time
import datetime
+import pooler
from report import report_sxw
class payment_order(report_sxw.rml_parse):
+
def __init__(self, cr, uid, name, context):
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]
+ 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 += 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 += 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
+
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:
|