Alexis de Lattre
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 726 additions and 0 deletions
-
64account_bank_reconciliation_summary_xlsx/README.rst
-
5account_bank_reconciliation_summary_xlsx/__init__.py
-
21account_bank_reconciliation_summary_xlsx/__manifest__.py
-
216account_bank_reconciliation_summary_xlsx/i18n/fr.po
-
3account_bank_reconciliation_summary_xlsx/models/__init__.py
-
13account_bank_reconciliation_summary_xlsx/models/account_move_line.py
-
3account_bank_reconciliation_summary_xlsx/report/__init__.py
-
228account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py
-
18account_bank_reconciliation_summary_xlsx/report/report.xml
-
23account_bank_reconciliation_summary_xlsx/views/account_bank_statement.xml
-
31account_bank_reconciliation_summary_xlsx/views/account_journal.xml
-
22account_bank_reconciliation_summary_xlsx/views/account_move_line.xml
-
3account_bank_reconciliation_summary_xlsx/wizard/__init__.py
-
39account_bank_reconciliation_summary_xlsx/wizard/bank_reconciliation_report_wizard.py
-
37account_bank_reconciliation_summary_xlsx/wizard/bank_reconciliation_report_wizard_view.xml
@ -0,0 +1,64 @@ |
|||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg |
|||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html |
|||
:alt: License: AGPL-3 |
|||
|
|||
=============================== |
|||
Bank Reconciliation Report XLSX |
|||
=============================== |
|||
|
|||
This module adds a Bank Reconciliation Report in Odoo in XLSX format. For each bank journal, the report displays: |
|||
|
|||
1. The balance of the bank account in the accounting, |
|||
2. The list of journal items of the bank account not linked to any bank statement lines, |
|||
3. The list of draft bank statement lines not linked to any journal items, |
|||
4. The computed balance of the bank account at the bank. |
|||
|
|||
The last field (computed balance of the bank account at the bank) must be compared to the real bank account balance at the bank. If there is a difference, you need to find the error in the accounting. The field *Computed balance of the bank account at the bank* is a formula, so you can easily change its computation to try to find the difference with the real bank account balance at the bank. |
|||
|
|||
Configuration |
|||
============= |
|||
|
|||
This module doesn't require any configuration. |
|||
|
|||
Usage |
|||
===== |
|||
|
|||
You can launch the Bank Reconciliation Report wizard from: |
|||
|
|||
* the menu *Accounting > Reports > OCA accounting reports > Bank Reconciliation*, |
|||
* the form view of a bank statement: click on the button *Bank Reconciliation Report*. |
|||
|
|||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas |
|||
:alt: Try me on Runbot |
|||
:target: https://runbot.odoo-community.org/runbot/91/10.0 |
|||
|
|||
Bug Tracker |
|||
=========== |
|||
|
|||
Bugs are tracked on `GitHub Issues |
|||
<https://github.com/OCA/account-financial-reporting/issues>`_. In case of trouble, please |
|||
check there if your issue has already been reported. If you spotted it first, |
|||
help us smashing it by providing a detailed and welcomed feedback. |
|||
|
|||
Credits |
|||
======= |
|||
|
|||
Contributors |
|||
------------ |
|||
|
|||
* Alexis de Lattre <alexis.delattre@akretion.com> |
|||
|
|||
Maintainer |
|||
---------- |
|||
|
|||
.. image:: https://odoo-community.org/logo.png |
|||
:alt: Odoo Community Association |
|||
:target: https://odoo-community.org |
|||
|
|||
This module is maintained by the OCA. |
|||
|
|||
OCA, or the Odoo Community Association, is a nonprofit organization whose |
|||
mission is to support the collaborative development of Odoo features and |
|||
promote its widespread use. |
|||
|
|||
To contribute to this module, please visit https://odoo-community.org. |
@ -0,0 +1,5 @@ |
|||
# -*- coding: utf-8 -*- |
|||
|
|||
from . import models |
|||
from . import report |
|||
from . import wizard |
@ -0,0 +1,21 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# © 2017 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>) |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|||
|
|||
{ |
|||
'name': 'Bank Reconciliation Report', |
|||
'version': '10.0.1.0.0', |
|||
'license': 'AGPL-3', |
|||
'author': "Akretion,Odoo Community Association (OCA)", |
|||
'website': 'http://www.akretion.com', |
|||
'summary': 'Adds an XLSX report to help on bank reconciliation', |
|||
'depends': ['account_financial_report_qweb', 'report_xlsx'], |
|||
'data': [ |
|||
'report/report.xml', |
|||
'wizard/bank_reconciliation_report_wizard_view.xml', |
|||
'views/account_bank_statement.xml', |
|||
'views/account_move_line.xml', |
|||
'views/account_journal.xml', |
|||
], |
|||
'installable': True, |
|||
} |
@ -0,0 +1,216 @@ |
|||
# Translation of Odoo Server. |
|||
# This file contains the translation of the following modules: |
|||
# * account_bank_reconciliation_summary_xlsx |
|||
# |
|||
msgid "" |
|||
msgstr "" |
|||
"Project-Id-Version: Odoo Server 10.0\n" |
|||
"Report-Msgid-Bugs-To: \n" |
|||
"POT-Creation-Date: 2018-12-04 10:29+0000\n" |
|||
"PO-Revision-Date: 2018-12-04 10:29+0000\n" |
|||
"Last-Translator: <>\n" |
|||
"Language-Team: \n" |
|||
"MIME-Version: 1.0\n" |
|||
"Content-Type: text/plain; charset=UTF-8\n" |
|||
"Content-Transfer-Encoding: \n" |
|||
"Plural-Forms: \n" |
|||
|
|||
#. module: account_bank_reconciliation_summary_xlsx |
|||
#: code:addons/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py:70 |
|||
#, python-format |
|||
msgid "%s - Bank Reconciliation" |
|||
msgstr "%s - Rapprochement bancaire" |
|||
|
|||
#. module: account_bank_reconciliation_summary_xlsx |
|||
#: model:ir.ui.view,arch_db:account_bank_reconciliation_summary_xlsx.account_journal_dashboard_kanban_view |
|||
msgid "<span>Report</span>" |
|||
msgstr "<span>Rapport</span>" |
|||
|
|||
#. module: account_bank_reconciliation_summary_xlsx |
|||
#: code:addons/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py:129 |
|||
#: code:addons/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py:182 |
|||
#, python-format |
|||
msgid "Amount" |
|||
msgstr "Montant" |
|||
|
|||
#. module: account_bank_reconciliation_summary_xlsx |
|||
#: code:addons/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py:92 |
|||
#, python-format |
|||
msgid "Balance %s:" |
|||
msgstr "Balance %s:" |
|||
|
|||
#. module: account_bank_reconciliation_summary_xlsx |
|||
#: model:ir.model.fields,field_description:account_bank_reconciliation_summary_xlsx.field_bank_reconciliation_report_wizard_journal_ids |
|||
msgid "Bank Journals" |
|||
msgstr "Journaux de banque" |
|||
|
|||
#. module: account_bank_reconciliation_summary_xlsx |
|||
#: model:ir.actions.act_window,name:account_bank_reconciliation_summary_xlsx.bank_reconciliation_report_wizard_action |
|||
#: model:ir.ui.menu,name:account_bank_reconciliation_summary_xlsx.bank_reconciliation_report_wizard_menu |
|||
#: model:ir.ui.view,arch_db:account_bank_reconciliation_summary_xlsx.account_journal_dashboard_kanban_view |
|||
msgid "Bank Reconciliation" |
|||
msgstr "Rapprochement bancaire" |
|||
|
|||
#. module: account_bank_reconciliation_summary_xlsx |
|||
#: model:ir.ui.view,arch_db:account_bank_reconciliation_summary_xlsx.bank_reconciliation_report_wizard_form |
|||
#: model:ir.ui.view,arch_db:account_bank_reconciliation_summary_xlsx.view_bank_statement_form |
|||
msgid "Bank Reconciliation Report" |
|||
msgstr "Rapport rapprochement bancaire" |
|||
|
|||
#. module: account_bank_reconciliation_summary_xlsx |
|||
#: model:ir.model,name:account_bank_reconciliation_summary_xlsx.model_bank_reconciliation_report_wizard |
|||
msgid "Bank Reconciliation Report Wizard" |
|||
msgstr "Wizard raport rapprochement bancaire" |
|||
|
|||
#. module: account_bank_reconciliation_summary_xlsx |
|||
#: model:ir.actions.report.xml,name:account_bank_reconciliation_summary_xlsx.bank_reconciliation_xlsx |
|||
msgid "Bank Reconciliation XLSX" |
|||
msgstr "Rapprochement bancaire XLSX" |
|||
|
|||
#. module: account_bank_reconciliation_summary_xlsx |
|||
#: model:ir.ui.view,arch_db:account_bank_reconciliation_summary_xlsx.bank_reconciliation_report_wizard_form |
|||
msgid "Cancel" |
|||
msgstr "Annuler" |
|||
|
|||
#. module: account_bank_reconciliation_summary_xlsx |
|||
#: code:addons/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py:210 |
|||
#, python-format |
|||
msgid "Computed Bank Account Balance at the Bank:" |
|||
msgstr "Solde théorique du compte bancaire :" |
|||
|
|||
#. module: account_bank_reconciliation_summary_xlsx |
|||
#: code:addons/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py:130 |
|||
#, python-format |
|||
msgid "Counter-part" |
|||
msgstr "Contre partie" |
|||
|
|||
#. module: account_bank_reconciliation_summary_xlsx |
|||
#: model:ir.model.fields,field_description:account_bank_reconciliation_summary_xlsx.field_bank_reconciliation_report_wizard_create_uid |
|||
msgid "Created by" |
|||
msgstr "Créé par" |
|||
|
|||
#. module: account_bank_reconciliation_summary_xlsx |
|||
#: model:ir.model.fields,field_description:account_bank_reconciliation_summary_xlsx.field_bank_reconciliation_report_wizard_create_date |
|||
msgid "Created on" |
|||
msgstr "Créé le" |
|||
|
|||
#. module: account_bank_reconciliation_summary_xlsx |
|||
#: code:addons/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py:128 |
|||
#: code:addons/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py:181 |
|||
#: model:ir.model.fields,field_description:account_bank_reconciliation_summary_xlsx.field_bank_reconciliation_report_wizard_date |
|||
#, python-format |
|||
msgid "Date" |
|||
msgstr "Date " |
|||
|
|||
#. module: account_bank_reconciliation_summary_xlsx |
|||
#: code:addons/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py:83 |
|||
#, python-format |
|||
msgid "Date:" |
|||
msgstr "Date :" |
|||
|
|||
#. module: account_bank_reconciliation_summary_xlsx |
|||
#: model:ir.model.fields,field_description:account_bank_reconciliation_summary_xlsx.field_bank_reconciliation_report_wizard_display_name |
|||
msgid "Display Name" |
|||
msgstr "Nom affiché" |
|||
|
|||
#. module: account_bank_reconciliation_summary_xlsx |
|||
#: code:addons/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py:169 |
|||
#, python-format |
|||
msgid "Draft bank statement lines:" |
|||
msgstr "Lignes non validées du relevé bancaire :" |
|||
|
|||
#. module: account_bank_reconciliation_summary_xlsx |
|||
#: model:ir.ui.view,arch_db:account_bank_reconciliation_summary_xlsx.bank_reconciliation_report_wizard_form |
|||
msgid "Export XLSX" |
|||
msgstr "Export XLSX" |
|||
|
|||
#. module: account_bank_reconciliation_summary_xlsx |
|||
#: model:ir.model.fields,field_description:account_bank_reconciliation_summary_xlsx.field_bank_reconciliation_report_wizard_id |
|||
msgid "ID" |
|||
msgstr "ID" |
|||
|
|||
#. module: account_bank_reconciliation_summary_xlsx |
|||
#: model:ir.model,name:account_bank_reconciliation_summary_xlsx.model_account_move_line |
|||
msgid "Journal Item" |
|||
msgstr "Écriture comptable" |
|||
|
|||
#. module: account_bank_reconciliation_summary_xlsx |
|||
#: code:addons/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py:113 |
|||
#, python-format |
|||
msgid "Journal items of account %s not linked to a bank statement line:" |
|||
msgstr "Ecritures comptables du compte %s non liées à une ligne de relevé bancaire :" |
|||
|
|||
#. module: account_bank_reconciliation_summary_xlsx |
|||
#: code:addons/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py:128 |
|||
#: code:addons/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py:181 |
|||
#, python-format |
|||
msgid "Label" |
|||
msgstr "Libellé" |
|||
|
|||
#. module: account_bank_reconciliation_summary_xlsx |
|||
#: model:ir.model.fields,field_description:account_bank_reconciliation_summary_xlsx.field_bank_reconciliation_report_wizard___last_update |
|||
msgid "Last Modified on" |
|||
msgstr "Dernière modification le" |
|||
|
|||
#. module: account_bank_reconciliation_summary_xlsx |
|||
#: model:ir.model.fields,field_description:account_bank_reconciliation_summary_xlsx.field_bank_reconciliation_report_wizard_write_uid |
|||
msgid "Last Updated by" |
|||
msgstr "Mis à jour par" |
|||
|
|||
#. module: account_bank_reconciliation_summary_xlsx |
|||
#: model:ir.model.fields,field_description:account_bank_reconciliation_summary_xlsx.field_bank_reconciliation_report_wizard_write_date |
|||
msgid "Last Updated on" |
|||
msgstr "Mis à jour le" |
|||
|
|||
#. module: account_bank_reconciliation_summary_xlsx |
|||
#: code:addons/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py:129 |
|||
#, python-format |
|||
msgid "Move Number" |
|||
msgstr "Numéro de pièce" |
|||
|
|||
#. module: account_bank_reconciliation_summary_xlsx |
|||
#: code:addons/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py:124 |
|||
#: code:addons/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py:177 |
|||
#, python-format |
|||
msgid "NONE" |
|||
msgstr "Rien" |
|||
|
|||
#. module: account_bank_reconciliation_summary_xlsx |
|||
#: code:addons/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py:215 |
|||
#, python-format |
|||
msgid "No Bank Journal" |
|||
msgstr "Pas de journal de banque" |
|||
|
|||
#. module: account_bank_reconciliation_summary_xlsx |
|||
#: code:addons/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py:220 |
|||
#, python-format |
|||
msgid "No bank journal selected. This report is only for bank journals." |
|||
msgstr "Pas de journal de banque sélectionné. Ce rapport est uniquement pour les journaux de banque." |
|||
|
|||
#. module: account_bank_reconciliation_summary_xlsx |
|||
#: code:addons/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py:128 |
|||
#: code:addons/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py:182 |
|||
#, python-format |
|||
msgid "Partner" |
|||
msgstr "Partenaire" |
|||
|
|||
#. module: account_bank_reconciliation_summary_xlsx |
|||
#: code:addons/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py:128 |
|||
#: code:addons/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py:181 |
|||
#, python-format |
|||
msgid "Ref." |
|||
msgstr "Ref." |
|||
|
|||
#. module: account_bank_reconciliation_summary_xlsx |
|||
#: code:addons/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py:129 |
|||
#: model:ir.model.fields,field_description:account_bank_reconciliation_summary_xlsx.field_account_move_line_statement_line_date |
|||
#, python-format |
|||
msgid "Statement Line Date" |
|||
msgstr "Date ligne relevé" |
|||
|
|||
#. module: account_bank_reconciliation_summary_xlsx |
|||
#: code:addons/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py:182 |
|||
#, python-format |
|||
msgid "Statement Ref." |
|||
msgstr "Ref. relevé" |
|||
|
@ -0,0 +1,3 @@ |
|||
# -*- coding: utf-8 -*- |
|||
|
|||
from . import account_move_line |
@ -0,0 +1,13 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# © 2017 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>) |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|||
|
|||
from odoo import fields, models |
|||
|
|||
|
|||
class AccountMoveLine(models.Model): |
|||
_inherit = 'account.move.line' |
|||
|
|||
statement_line_date = fields.Date( |
|||
string='Statement Line Date', |
|||
related='move_id.statement_line_id.date', store=True, readonly=True) |
@ -0,0 +1,3 @@ |
|||
# -*- coding: utf-8 -*- |
|||
|
|||
from . import bank_reconciliation_xlsx |
@ -0,0 +1,228 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# © 2017 Akretion France (Alexis de Lattre <alexis.delattre@akretion.com>) |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|||
|
|||
from odoo.addons.report_xlsx.report.report_xlsx import ReportXlsx |
|||
from odoo import fields, _ |
|||
from odoo.tools import DEFAULT_SERVER_DATE_FORMAT |
|||
from datetime import datetime |
|||
|
|||
|
|||
class BankReconciliationXlsx(ReportXlsx): |
|||
|
|||
def generate_xlsx_report(self, workbook, data, wizard): |
|||
date = wizard.date |
|||
date_dt = fields.Date.from_string(date) |
|||
no_bank_journal = True |
|||
for o in wizard.journal_ids: |
|||
no_bank_journal = False |
|||
# Start styles |
|||
lang_code = self.env.user.lang |
|||
lang = False |
|||
if lang_code: |
|||
lang = self.env['res.lang'].search([('code', '=', lang_code)]) |
|||
if not lang: |
|||
lang = self.env['res.lang'].search([], limit=1) |
|||
xls_date_format = lang.date_format.replace('%Y', 'yyyy').\ |
|||
replace('%m', 'mm').replace('%d', 'dd').replace('%y', 'yy') |
|||
|
|||
doc_title = workbook.add_format({'bold': True, 'font_size': 16}) |
|||
col_title = workbook.add_format({ |
|||
'bold': True, 'bg_color': '#e2e2fa', |
|||
'text_wrap': True, 'font_size': 10, |
|||
}) |
|||
title_right = workbook.add_format({ |
|||
'bold': True, 'bg_color': '#e6e6fa', |
|||
'font_size': 10, 'align': 'right', |
|||
}) |
|||
title_date = workbook.add_format({ |
|||
'bg_color': '#f6f6ff', 'bold': True, |
|||
'num_format': xls_date_format, |
|||
'font_size': 10, |
|||
'align': 'left'}) |
|||
label_bold = workbook.add_format({ |
|||
'bold': True, 'text_wrap': False, 'font_size': 10}) |
|||
none = workbook.add_format({ |
|||
'bold': True, 'font_size': 10, 'align': 'right'}) |
|||
regular = workbook.add_format({'font_size': 10}) |
|||
if '%' in xls_date_format: |
|||
# fallback |
|||
xls_date_format = 'yyyy-mm-dd' |
|||
regular_date = workbook.add_format({ |
|||
'num_format': xls_date_format, |
|||
'font_size': 10, |
|||
'align': 'left'}) |
|||
cur_format = u'#,##0.00 %s' % ( |
|||
o.company_id.currency_id.symbol or |
|||
o.company_id.currency_id.name) |
|||
# It seems that Excel replaces automatically the decimal |
|||
# and thousand separator by those of the language under which |
|||
# Excel runs |
|||
regular_currency = workbook.add_format( |
|||
{'num_format': cur_format, 'font_size': 10}) |
|||
regular_currency_bg = workbook.add_format({ |
|||
'num_format': cur_format, 'font_size': 10, |
|||
'bg_color': '#f6f6ff'}) |
|||
# End styles |
|||
|
|||
sheet = workbook.add_worksheet(o.code or o.name) |
|||
sheet.write( |
|||
0, 0, |
|||
_('%s - %s - Bank Reconciliation') % ( |
|||
o.company_id.name, o.display_name), |
|||
doc_title) |
|||
sheet.set_row(0, 26) |
|||
sheet.set_row(1, 25) |
|||
sheet.set_column(0, 0, 10) |
|||
sheet.set_column(1, 1, 40) |
|||
sheet.set_column(2, 2, 15) |
|||
sheet.set_column(3, 3, 25) |
|||
sheet.set_column(4, 4, 12) |
|||
sheet.set_column(5, 5, 18) |
|||
sheet.set_column(6, 6, 14) |
|||
sheet.set_column(7, 7, 14) |
|||
row = 2 |
|||
sheet.write(row, 0, _("Date:"), title_right) |
|||
sheet.write(row, 1, date_dt, title_date) |
|||
# 1) Show accounting balance of bank account |
|||
row += 2 |
|||
bank_account = o.default_debit_account_id |
|||
for col in range(3): |
|||
sheet.write(row, col, '', title_right) |
|||
sheet.write( |
|||
row, 3, |
|||
_('Balance %s:') % bank_account.code, title_right) |
|||
amount_field = 'balance' |
|||
# TODO: add support for bank accounts in foreign currency |
|||
# if not o.currency_id else 'amount_currency' |
|||
query = """ |
|||
SELECT sum(%s) FROM account_move_line |
|||
WHERE account_id=%%s AND date <= %%s""" % (amount_field, ) |
|||
self.env.cr.execute(query, (bank_account.id, date)) |
|||
query_results = self.env.cr.dictfetchall() |
|||
if query_results: |
|||
account_bal = query_results[0].get('sum') or 0.0 |
|||
else: |
|||
account_bal = 0.0 |
|||
|
|||
sheet.write(row, 4, account_bal, regular_currency_bg) |
|||
bank_bal = account_bal |
|||
formula = '=E%d' % (row + 1) |
|||
# 2) Show account move line that are not linked to bank statement |
|||
# line or linked to a statement line after the date |
|||
row += 2 |
|||
sheet.write( |
|||
row, 0, _( |
|||
'Journal items of account %s not linked to a bank ' |
|||
'statement line:') % bank_account.code, |
|||
label_bold) |
|||
mlines = self.env['account.move.line'].search([ |
|||
('account_id', '=', bank_account.id), |
|||
('journal_id', '=', o.id), # to avoid initial line |
|||
('date', '<=', date), |
|||
'|', ('statement_line_date', '=', False), |
|||
('statement_line_date', '>', date)]) |
|||
if not mlines: |
|||
sheet.write(row, 4, _('NONE'), none) |
|||
else: |
|||
row += 1 |
|||
col_labels = [ |
|||
_('Date'), _('Label'), _('Ref.'), _('Partner'), |
|||
_('Amount'), _('Statement Line Date'), _('Move Number'), |
|||
_('Counter-part')] |
|||
col = 0 |
|||
for col_label in col_labels: |
|||
sheet.write(row, col, col_label, col_title) |
|||
col += 1 |
|||
m_start_row = m_end_row = row + 1 |
|||
for mline in mlines: |
|||
row += 1 |
|||
m_end_row = row |
|||
move = mline.move_id |
|||
bank_bal -= mline.balance |
|||
date_dt = fields.Date.from_string(mline.date) |
|||
sheet.write(row, 0, date_dt, regular_date) |
|||
sheet.write(row, 1, mline.name, regular) |
|||
sheet.write(row, 2, mline.ref or '', regular) |
|||
sheet.write( |
|||
row, 3, mline.partner_id.display_name or '', regular) |
|||
sheet.write(row, 4, mline.balance, regular_currency) |
|||
if mline.statement_line_date: |
|||
stl_date_dt = fields.Date.from_string( |
|||
mline.statement_line_date) |
|||
else: |
|||
stl_date_dt = '' |
|||
sheet.write(row, 5, stl_date_dt, regular_date) |
|||
sheet.write(row, 6, move.name, regular) |
|||
# counter-part accounts |
|||
cpart = [] |
|||
for line in move.line_ids: |
|||
if ( |
|||
line.account_id != bank_account and |
|||
line.account_id.code not in cpart): |
|||
cpart.append(line.account_id.code) |
|||
sheet.write(row, 7, ' ,'.join(cpart), regular) |
|||
|
|||
formula += '-SUM(E%d:E%d)' % (m_start_row + 1, m_end_row + 1) |
|||
|
|||
# 3) Add draft bank statement lines |
|||
row += 2 # skip 1 line |
|||
sheet.write( |
|||
row, 0, _( |
|||
'Draft bank statement lines:'), |
|||
label_bold) |
|||
blines = self.env['account.bank.statement.line'].search([ |
|||
('journal_entry_ids', '=', False), |
|||
('journal_id', '=', o.id), |
|||
('date', '<=', date)]) |
|||
if not blines: |
|||
sheet.write(row, 4, _('NONE'), none) |
|||
else: |
|||
row += 1 |
|||
col_labels = [ |
|||
_('Date'), _('Label'), _('Ref.'), |
|||
_('Partner'), _('Amount'), _('Statement Ref.'), '', ''] |
|||
col = 0 |
|||
for col_label in col_labels: |
|||
sheet.write(row, col, col_label, col_title) |
|||
col += 1 |
|||
b_start_row = b_end_row = row + 1 |
|||
for bline in blines: |
|||
row += 1 |
|||
b_end_row = row |
|||
bank_bal += bline.amount |
|||
date_dt = datetime.strptime( |
|||
bline.date, DEFAULT_SERVER_DATE_FORMAT) |
|||
sheet.write(row, 0, date_dt, regular_date) |
|||
sheet.write(row, 1, bline.name, regular) |
|||
sheet.write(row, 2, bline.ref or '', regular) |
|||
sheet.write( |
|||
row, 3, bline.partner_id.display_name or '', regular) |
|||
sheet.write(row, 4, bline.amount, regular_currency) |
|||
sheet.write( |
|||
row, 5, bline.statement_id.display_name or '', |
|||
regular_currency) |
|||
formula += '+SUM(E%d:E%d)' % (b_start_row + 1, b_end_row + 1) |
|||
|
|||
# 4) Theoric bank account balance at the bank |
|||
row += 2 |
|||
for col in range(3): |
|||
sheet.write(row, col, '', title_right) |
|||
sheet.write( |
|||
row, 3, _('Computed Bank Account Balance at the Bank:'), |
|||
title_right) |
|||
sheet.write_formula( |
|||
row, 4, formula, regular_currency_bg, bank_bal) |
|||
if no_bank_journal: |
|||
sheet = workbook.add_worksheet(_('No Bank Journal')) |
|||
sheet.set_row(0, 30) |
|||
warn_msg = workbook.add_format( |
|||
{'bold': True, 'font_size': 16, 'font_color': '#003b6f'}) |
|||
sheet.write( |
|||
0, 0, _( |
|||
"No bank journal selected. " |
|||
"This report is only for bank journals."), warn_msg) |
|||
|
|||
|
|||
BankReconciliationXlsx( |
|||
'report.bank.reconciliation.xlsx', 'bank.reconciliation.report.wizard') |
@ -0,0 +1,18 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<!-- |
|||
© 2017 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>) |
|||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|||
--> |
|||
|
|||
<odoo> |
|||
|
|||
<report |
|||
id="bank_reconciliation_xlsx" |
|||
model="bank.reconciliation.report.wizard" |
|||
string="Bank Reconciliation XLSX" |
|||
report_type="xlsx" |
|||
name="bank.reconciliation.xlsx" |
|||
file="bank.reconciliation.xlsx" |
|||
/> |
|||
|
|||
</odoo> |
@ -0,0 +1,23 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<!-- |
|||
© 2017 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>) |
|||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|||
--> |
|||
|
|||
<odoo> |
|||
|
|||
|
|||
<record id="view_bank_statement_form" model="ir.ui.view"> |
|||
<field name="name">bank_rec_summary.account.bank.statement.form</field> |
|||
<field name="model">account.bank.statement</field> |
|||
<field name="inherit_id" ref="account.view_bank_statement_form"/> |
|||
<field name="arch" type="xml"> |
|||
<button name="check_confirm_bank" position="after"> |
|||
<button name="%(bank_reconciliation_report_wizard_action)d" type="action" |
|||
string="Bank Reconciliation Report" context="{'default_journal_ids': [journal_id]}"/> |
|||
</button> |
|||
</field> |
|||
</record> |
|||
|
|||
|
|||
</odoo> |
@ -0,0 +1,31 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<!-- |
|||
Copyright 2018 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>) |
|||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|||
--> |
|||
|
|||
<odoo> |
|||
|
|||
<!-- Accounting Dashboard --> |
|||
<record id="account_journal_dashboard_kanban_view" model="ir.ui.view"> |
|||
<field name="name">bank_reconciliation_summarry.account_journal_dashboard</field> |
|||
<field name="model">account.journal</field> |
|||
<field name="inherit_id" ref="account.account_journal_dashboard_kanban_view"/> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//div[@name='bank_cash_commands']/.." position="after"> |
|||
<div class="col-xs-4 o_kanban_card_manage_section o_kanban_manage_new"> |
|||
<div class="o_kanban_card_manage_title"> |
|||
<span>Report</span> |
|||
</div> |
|||
<div name="bank_reconciliation_report"> |
|||
<a name="%(bank_reconciliation_report_wizard_action)d" |
|||
type="action" |
|||
context="{'default_journal_ids': [active_id]}">Bank Reconciliation</a> |
|||
</div> |
|||
</div> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
|
|||
|
|||
</odoo> |
@ -0,0 +1,22 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<!-- |
|||
© 2017 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>) |
|||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|||
--> |
|||
|
|||
<odoo> |
|||
|
|||
|
|||
<record id="view_move_line_form" model="ir.ui.view"> |
|||
<field name="name">bank_rec_summarry.account_move_line_form</field> |
|||
<field name="model">account.move.line</field> |
|||
<field name="inherit_id" ref="account.view_move_line_form"/> |
|||
<field name="arch" type="xml"> |
|||
<field name="statement_id" position="after"> |
|||
<field name="statement_line_date"/> |
|||
</field> |
|||
</field> |
|||
</record> |
|||
|
|||
|
|||
</odoo> |
@ -0,0 +1,3 @@ |
|||
# -*- coding: utf-8 -*- |
|||
|
|||
from . import bank_reconciliation_report_wizard |
@ -0,0 +1,39 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# © 2017 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>) |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|||
|
|||
from odoo import api, fields, models |
|||
|
|||
|
|||
class BankReconciliationReportWizard(models.TransientModel): |
|||
_name = "bank.reconciliation.report.wizard" |
|||
_description = "Bank Reconciliation Report Wizard" |
|||
|
|||
@api.model |
|||
def _default_journal_ids(self): |
|||
journals = self.env['account.journal'].search([ |
|||
('type', '=', 'bank'), |
|||
('bank_account_id', '!=', False), |
|||
('company_id', '=', self.env.user.company_id.id), |
|||
]) |
|||
return journals |
|||
|
|||
date = fields.Date( |
|||
required=True, |
|||
default=fields.Date.context_today) |
|||
journal_ids = fields.Many2many( |
|||
'account.journal', string='Bank Journals', |
|||
domain=[('type', '=', 'bank')], required=True, |
|||
default=_default_journal_ids) |
|||
|
|||
def open_xlsx(self): |
|||
action = { |
|||
'type': 'ir.actions.report.xml', |
|||
'report_name': 'bank.reconciliation.xlsx', |
|||
'datas': { |
|||
'model': self._name, |
|||
'ids': self.ids, |
|||
}, |
|||
'context': self._context, |
|||
} |
|||
return action |
@ -0,0 +1,37 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<!-- |
|||
© 2017 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>) |
|||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|||
--> |
|||
|
|||
<odoo> |
|||
|
|||
|
|||
<record id="bank_reconciliation_report_wizard_form" model="ir.ui.view"> |
|||
<field name="name">bank.reconciliation.report.wizard.form</field> |
|||
<field name="model">bank.reconciliation.report.wizard</field> |
|||
<field name="arch" type="xml"> |
|||
<form string="Bank Reconciliation Report"> |
|||
<group name="main"> |
|||
<field name="date"/> |
|||
<field name="journal_ids" widget="many2many_tags"/> |
|||
</group> |
|||
<footer> |
|||
<button name="open_xlsx" string="Export XLSX" type="object" class="btn-primary"/> |
|||
<button special="cancel" string="Cancel" class="oe_link"/> |
|||
</footer> |
|||
</form> |
|||
</field> |
|||
</record> |
|||
|
|||
<record id="bank_reconciliation_report_wizard_action" model="ir.actions.act_window"> |
|||
<field name="name">Bank Reconciliation</field> |
|||
<field name="res_model">bank.reconciliation.report.wizard</field> |
|||
<field name="view_mode">form</field> |
|||
<field name="target">new</field> |
|||
</record> |
|||
|
|||
<menuitem id="bank_reconciliation_report_wizard_menu" action="bank_reconciliation_report_wizard_action" parent="account_financial_report_qweb.menu_oca_reports" groups="account.group_account_manager,account.group_account_user" sequence="100"/> |
|||
|
|||
|
|||
</odoo> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue