From ef6e8add72efa08df24649aa999e020db90324dc Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Tue, 27 May 2014 11:51:04 -0400 Subject: [PATCH] [ADD] npg_bank_account_reconciliation: add report detailed_reconciliation.mako and summary_reconciliation.mako --- npg_bank_account_reconciliation/__init__.py | 3 +- .../__openerp__.py | 14 +- .../report/__init__.py | 23 + .../report/detailed_reconciliation.mako | 444 ++++++++++++++++++ .../report/reconciliation.py | 43 ++ .../report/report.xml | 21 + .../report/summary_reconciliation.mako | 160 +++++++ 7 files changed, 699 insertions(+), 9 deletions(-) create mode 100644 npg_bank_account_reconciliation/report/__init__.py create mode 100644 npg_bank_account_reconciliation/report/detailed_reconciliation.mako create mode 100644 npg_bank_account_reconciliation/report/reconciliation.py create mode 100644 npg_bank_account_reconciliation/report/report.xml create mode 100644 npg_bank_account_reconciliation/report/summary_reconciliation.mako diff --git a/npg_bank_account_reconciliation/__init__.py b/npg_bank_account_reconciliation/__init__.py index 485ac7050..a15b3b7d3 100644 --- a/npg_bank_account_reconciliation/__init__.py +++ b/npg_bank_account_reconciliation/__init__.py @@ -22,5 +22,4 @@ import npg_bank_account_reconciliation import account_move_line - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: +import report diff --git a/npg_bank_account_reconciliation/__openerp__.py b/npg_bank_account_reconciliation/__openerp__.py index 9a72f3f2f..3db3b50d3 100644 --- a/npg_bank_account_reconciliation/__openerp__.py +++ b/npg_bank_account_reconciliation/__openerp__.py @@ -96,19 +96,19 @@ Contributors """, 'author': 'NovaPoint Group LLC', 'website': ' http://www.novapointgroup.com', - 'depends': ['account_voucher'], + 'depends': [ + 'account_voucher', + 'report_webkit', + ], 'init_xml': [], 'update_xml': ["security/npg_bank_account_reconciliation_security.xml", "security/ir.model.access.csv", "npg_bank_account_reconciliation_view.xml", "account_move_line_view.xml"], 'demo_xml': [], + 'data': [ + 'report/report.xml', + ], 'installable': True, 'active': False, } - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: - - - - diff --git a/npg_bank_account_reconciliation/report/__init__.py b/npg_bank_account_reconciliation/report/__init__.py new file mode 100644 index 000000000..22db7be05 --- /dev/null +++ b/npg_bank_account_reconciliation/report/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2011 NovaPoint Group LLC () +# Copyright (C) 2004-2010 OpenERP SA () +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see +# +############################################################################## + +import reconciliation diff --git a/npg_bank_account_reconciliation/report/detailed_reconciliation.mako b/npg_bank_account_reconciliation/report/detailed_reconciliation.mako new file mode 100644 index 000000000..d15b2d0d4 --- /dev/null +++ b/npg_bank_account_reconciliation/report/detailed_reconciliation.mako @@ -0,0 +1,444 @@ + + + + + + %for rec in objects: + + + + +
+ ${_("Detailed %s account:") % rec.name} ${rec.account_id.code} - + ${rec.account_id.name} +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + %for rec_line in [line for line in rec.debit_move_line_ids if line.cleared_bank_account]: + + + + + + + + + %endfor + + + + + + + + + %for rec_line in [line for line in rec.credit_move_line_ids if line.cleared_bank_account]: + + + + + + + + + %endfor + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + %for rec_line in [line for line in rec.debit_move_line_ids if not line.cleared_bank_account]: + + + + + + + + + %endfor + + + + + + + + + %for rec_line in [line for line in rec.credit_move_line_ids if not line.cleared_bank_account]: + + + + + + + + + %endfor + + + + + + + + + + + + + + + + +
+ + ${_("Date")} + + ${_("Name")} + + ${_("Reference")} + + ${_("Partner")} + + ${_("Amount")} +
+ ${_("Beginning Balance")} + + + + + + ${formatLang(rec.starting_balance, monetary=True, currency_obj=rec.company_id.currency_id)} +
+ ${_("Cleared Transactions")} + + + + + +
+ ${_("Cheques and Payments")}${" - %s " % int(rec.sum_of_debits_lines)}${_("items")} + + + + + + ${formatLang(rec.sum_of_debits, monetary=True, currency_obj=rec.company_id.currency_id)} +
+ + ${rec_line.date} + + ${rec_line.name} + + ${rec_line.ref} + + ${rec_line.partner_id.name} + + ${formatLang(rec_line.amount, monetary=True, currency_obj=rec.company_id.currency_id)} +
+ ${_("Deposits and Credits")}${" - %s " % int(rec.sum_of_credits_lines)}${_("items")} + + + + + + ${formatLang(-rec.sum_of_credits, monetary=True, currency_obj=rec.company_id.currency_id)} +
+ + ${rec_line.date} + + ${rec_line.name} + + ${rec_line.ref} + + ${rec_line.partner_id.name} + + ${formatLang(rec_line.amount, monetary=True, currency_obj=rec.company_id.currency_id)} +
+ ${_("Total Cleared Transactions")} + + + + + + ${formatLang(rec.cleared_balance, monetary=True, currency_obj=rec.company_id.currency_id)} +
+ ${_("Cleared Balance")} + + + + + + ${formatLang(rec.cleared_balance + rec.starting_balance, monetary=True, currency_obj=rec.company_id.currency_id)} +
+ ${_("Uncleared Transactions")} + + + + + +
+ ${_("Cheques and Payments")}${" - %s " % int(rec.sum_of_debits_lines_unclear)}${_("items")} + + + + + + ${formatLang(rec.sum_of_debits_unclear, monetary=True, currency_obj=rec.company_id.currency_id)} +
+ + ${rec_line.date} + + ${rec_line.name} + + ${rec_line.ref} + + ${rec_line.partner_id.name} + + ${formatLang(rec_line.amount, monetary=True, currency_obj=rec.company_id.currency_id)} +
+ ${_("Deposits and Credits")}${" - %s " % int(rec.sum_of_credits_lines_unclear)}${_("items")} + + + + + + ${formatLang(-rec.sum_of_credits_unclear, monetary=True, currency_obj=rec.company_id.currency_id)} +
+ + ${rec_line.date} + + ${rec_line.name} + + ${rec_line.ref} + + ${rec_line.partner_id.name} + + ${formatLang(rec_line.amount, monetary=True, currency_obj=rec.company_id.currency_id)} +
+ ${_("Total Uncleared Transactions")} + + + + + + ${formatLang(rec.uncleared_balance, monetary=True, currency_obj=rec.company_id.currency_id)} +
+ ${_("Register Balance as of")}${" %s" % formatLang(rec.ending_date, date=True, currency_obj=rec.company_id.currency_id)} + + + + + + ${formatLang(rec.starting_balance + rec.cleared_balance + rec.uncleared_balance, monetary=True, currency_obj=rec.company_id.currency_id)} +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ ${_("Summary %s account:") % rec.name} ${rec.account_id.code} - + ${rec.account_id.name} +
+ ${_("Beginning Balance")} + + ${formatLang(rec.starting_balance, monetary=True, currency_obj=rec.company_id.currency_id)} +
+ ${_("Cleared Transactions")} + +
+ ${_("Cheques and Payments")}${" - %s " % int(rec.sum_of_debits_lines)}${_("items")} + + ${formatLang(rec.sum_of_debits, monetary=True, currency_obj=rec.company_id.currency_id)} +
+ ${_("Deposits and Credits")}${" - %s " % int(rec.sum_of_credits_lines)}${_("items")} + + ${formatLang(-rec.sum_of_credits, monetary=True, currency_obj=rec.company_id.currency_id)} +
+ ${_("Total Cleared Transactions")} + + ${formatLang(rec.cleared_balance, monetary=True, currency_obj=rec.company_id.currency_id)} +
+ ${_("Cleared Balance")} + + ${formatLang(rec.cleared_balance + rec.starting_balance, monetary=True, currency_obj=rec.company_id.currency_id)} +
+ ${_("Uncleared Transactions")} + +
+ ${_("Cheques and Payments")}${" - %s " % int(rec.sum_of_debits_lines_unclear)}${_("items")} + + ${formatLang(rec.sum_of_debits_unclear, monetary=True, currency_obj=rec.company_id.currency_id)} +
+ ${_("Deposits and Credits")}${" - %s " % int(rec.sum_of_credits_lines_unclear)}${_("items")} + + ${formatLang(-rec.sum_of_credits_unclear, monetary=True, currency_obj=rec.company_id.currency_id)} +
+ ${_("Total Uncleared Transactions")} + + ${formatLang(rec.uncleared_balance, monetary=True, currency_obj=rec.company_id.currency_id)} +
+ ${_("Register Balance as of")}${" %s" % formatLang(rec.ending_date, date=True, currency_obj=rec.company_id.currency_id)} + + ${formatLang(rec.starting_balance + rec.cleared_balance + rec.uncleared_balance, monetary=True, currency_obj=rec.company_id.currency_id)} +
+ + %endfor + + diff --git a/npg_bank_account_reconciliation/report/reconciliation.py b/npg_bank_account_reconciliation/report/reconciliation.py new file mode 100644 index 000000000..e3e9950df --- /dev/null +++ b/npg_bank_account_reconciliation/report/reconciliation.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2011 NovaPoint Group LLC () +# Copyright (C) 2004-2010 OpenERP SA () +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see +# +############################################################################## +from openerp.report import report_sxw + + +class Reconciliation(report_sxw.rml_parse): + def __init__(self, cr, uid, name, context=None): + super(Reconciliation, self).__init__(cr, uid, name, context=context) + + +report_sxw.report_sxw( + 'report.detailed.reconciliation.webkit', + 'bank.acc.rec.statement', + 'addons/deposit_ticket_report_webkit/report/detailed_reconciliation.mako', + parser=Reconciliation, +) + + +report_sxw.report_sxw( + 'report.summary.reconciliation.webkit', + 'bank.acc.rec.statement', + 'addons/deposit_ticket_report_webkit/report/summary_reconciliation.mako', + parser=Reconciliation +) diff --git a/npg_bank_account_reconciliation/report/report.xml b/npg_bank_account_reconciliation/report/report.xml new file mode 100644 index 000000000..460c83342 --- /dev/null +++ b/npg_bank_account_reconciliation/report/report.xml @@ -0,0 +1,21 @@ + + + + + + + + + diff --git a/npg_bank_account_reconciliation/report/summary_reconciliation.mako b/npg_bank_account_reconciliation/report/summary_reconciliation.mako new file mode 100644 index 000000000..c588627c3 --- /dev/null +++ b/npg_bank_account_reconciliation/report/summary_reconciliation.mako @@ -0,0 +1,160 @@ + + + + + + %for rec in objects: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ ${_("Summary account:")} ${rec.account_id.code} - + ${rec.account_id.name} +
+ ${_("Beginning Balance")} + + ${formatLang(rec.starting_balance, monetary=True, currency_obj=rec.company_id.currency_id)} +
+ ${_("Cleared Transactions")} + +
+ ${_("Cheques and Payments")}${" - %s " % int(rec.sum_of_debits_lines)}${_("items")} + + ${formatLang(rec.sum_of_debits, monetary=True, currency_obj=rec.company_id.currency_id)} +
+ ${_("Deposits and Credits")}${" - %s " % int(rec.sum_of_credits_lines)}${_("items")} + + ${formatLang(-rec.sum_of_credits, monetary=True, currency_obj=rec.company_id.currency_id)} +
+ ${_("Total Cleared Transactions")} + + ${formatLang(rec.cleared_balance, monetary=True, currency_obj=rec.company_id.currency_id)} +
+ ${_("Cleared Balance")} + + ${formatLang(rec.cleared_balance + rec.starting_balance, monetary=True, currency_obj=rec.company_id.currency_id)} +
+ ${_("Uncleared Transactions")} + +
+ ${_("Cheques and Payments")}${" - %s " % int(rec.sum_of_debits_lines_unclear)}${_("items")} + + ${formatLang(rec.sum_of_debits_unclear, monetary=True, currency_obj=rec.company_id.currency_id)} +
+ ${_("Deposits and Credits")}${" - %s " % int(rec.sum_of_credits_lines_unclear)}${_("items")} + + ${formatLang(-rec.sum_of_credits_unclear, monetary=True, currency_obj=rec.company_id.currency_id)} +
+ ${_("Total Uncleared Transactions")} + + ${formatLang(rec.uncleared_balance, monetary=True, currency_obj=rec.company_id.currency_id)} +
+ ${_("Register Balance as of")}${" %s" % formatLang(rec.ending_date, date=True, currency_obj=rec.company_id.currency_id)} + + ${formatLang(rec.starting_balance + rec.cleared_balance + rec.uncleared_balance, monetary=True, currency_obj=rec.company_id.currency_id)} +
+ + %endfor + +