From 61d85180a8be8127bbd301124eb5372501fea8b4 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Fri, 9 Jun 2017 00:05:30 +0200 Subject: [PATCH 01/12] Add module account_bank_reconciliation_summary_xlsx --- .../README.rst | 65 ++++++ .../__init__.py | 4 + .../__manifest__.py | 18 ++ .../models/__init__.py | 3 + .../models/account_bank_statement.py | 22 ++ .../report/__init__.py | 3 + .../report/bank_reconciliation_xlsx.py | 200 ++++++++++++++++++ .../report/report.xml | 18 ++ .../views/account_bank_statement_view.xml | 23 ++ 9 files changed, 356 insertions(+) create mode 100644 account_bank_reconciliation_summary_xlsx/README.rst create mode 100644 account_bank_reconciliation_summary_xlsx/__init__.py create mode 100644 account_bank_reconciliation_summary_xlsx/__manifest__.py create mode 100644 account_bank_reconciliation_summary_xlsx/models/__init__.py create mode 100644 account_bank_reconciliation_summary_xlsx/models/account_bank_statement.py create mode 100644 account_bank_reconciliation_summary_xlsx/report/__init__.py create mode 100644 account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py create mode 100644 account_bank_reconciliation_summary_xlsx/report/report.xml create mode 100644 account_bank_reconciliation_summary_xlsx/views/account_bank_statement_view.xml diff --git a/account_bank_reconciliation_summary_xlsx/README.rst b/account_bank_reconciliation_summary_xlsx/README.rst new file mode 100644 index 00000000..e0a3f6ee --- /dev/null +++ b/account_bank_reconciliation_summary_xlsx/README.rst @@ -0,0 +1,65 @@ +.. 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 erreor 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 get the Bank Reconciliation Report from: + +* the form view of a bank bournal: click on *Print > Bank Reconciliation XLSX* +* the tree view of journals: select one or several journals and click on *Print > Bank Reconciliation XLSX* (if you selected several bank journals, you will get one tab per journal) +* 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 +`_. 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 + +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. diff --git a/account_bank_reconciliation_summary_xlsx/__init__.py b/account_bank_reconciliation_summary_xlsx/__init__.py new file mode 100644 index 00000000..7a6c1b03 --- /dev/null +++ b/account_bank_reconciliation_summary_xlsx/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- + +from . import models +from . import report diff --git a/account_bank_reconciliation_summary_xlsx/__manifest__.py b/account_bank_reconciliation_summary_xlsx/__manifest__.py new file mode 100644 index 00000000..680a34e3 --- /dev/null +++ b/account_bank_reconciliation_summary_xlsx/__manifest__.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +# © 2017 Akretion (Alexis de Lattre ) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + 'name': 'Account Bank Statement Reconciliation Summary', + '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 statement reconciliation', + 'depends': ['account', 'report_xlsx'], + 'data': [ + 'report/report.xml', + 'views/account_bank_statement_view.xml', + ], + 'installable': True, +} diff --git a/account_bank_reconciliation_summary_xlsx/models/__init__.py b/account_bank_reconciliation_summary_xlsx/models/__init__.py new file mode 100644 index 00000000..ac116473 --- /dev/null +++ b/account_bank_reconciliation_summary_xlsx/models/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import account_bank_statement diff --git a/account_bank_reconciliation_summary_xlsx/models/account_bank_statement.py b/account_bank_reconciliation_summary_xlsx/models/account_bank_statement.py new file mode 100644 index 00000000..d43c4219 --- /dev/null +++ b/account_bank_reconciliation_summary_xlsx/models/account_bank_statement.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# © 2017 Akretion France (Alexis de Lattre ) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import models + + +class AccountBankStatement(models.Model): + _inherit = 'account.bank.statement' + + def print_reconciliation_xlsx(self): + self.ensure_one() + action = { + 'type': 'ir.actions.report.xml', + 'report_name': 'bank.reconciliation.xlsx', + 'datas': { + 'model': 'account.journal', + 'ids': [self.journal_id.id], + }, + 'context': self._context, + } + return action diff --git a/account_bank_reconciliation_summary_xlsx/report/__init__.py b/account_bank_reconciliation_summary_xlsx/report/__init__.py new file mode 100644 index 00000000..ce3ccb2c --- /dev/null +++ b/account_bank_reconciliation_summary_xlsx/report/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import bank_reconciliation_xlsx diff --git a/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py b/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py new file mode 100644 index 00000000..4e96c097 --- /dev/null +++ b/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py @@ -0,0 +1,200 @@ +# -*- coding: utf-8 -*- +# © 2017 Akretion France (Alexis de Lattre ) +# 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 _ +from odoo.tools import DEFAULT_SERVER_DATE_FORMAT +from datetime import datetime + + +class BankReconciliationXlsx(ReportXlsx): + + def generate_xlsx_report(self, workbook, data, journals): + no_bank_journal = True + for o in journals.filtered(lambda o: o.type == 'bank'): + no_bank_journal = False + # Start styles + 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', + }) + 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}) + 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') + 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'#%s##0%s00 %s' % ( + lang.thousands_sep or '', + lang.decimal_point or '', + o.company_id.currency_id.symbol or + o.company_id.currency_id.name) + 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 - Bank Reconciliation') % 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, 14) + sheet.set_column(6, 6, 22) + row = 2 + sheet.write(row, 0, _("Date:"), label_bold) + # I can't use fields.Date.context_today(self) + sheet.write(row, 1, datetime.today(), regular_date) + # 1) Show accounting balance of bank account + bank_account = o.default_debit_account_id + 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""" % (amount_field,) + self.env.cr.execute(query, (bank_account.id,)) + 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 account + 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 + ('statement_id', '=', False)]) + if not mlines: + sheet.write(row, 4, _('NONE'), none) + else: + row += 1 + sheet.write(row, 0, _('Date'), col_title) + sheet.write(row, 1, _('Label'), col_title) + sheet.write(row, 2, _('Ref.'), col_title) + sheet.write(row, 3, _('Partner'), col_title) + sheet.write(row, 4, _('Amount'), col_title) + sheet.write(row, 5, _('Move Number'), col_title) + sheet.write(row, 6, _('Counter-part'), col_title) + 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 = datetime.strptime( + mline.date, DEFAULT_SERVER_DATE_FORMAT) + 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) + sheet.write(row, 5, 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, 6, ' ,'.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)]) + if not blines: + sheet.write(row, 4, _('NONE'), none) + else: + row += 1 + sheet.write(row, 0, _('Date'), col_title) + sheet.write(row, 1, _('Label'), col_title) + sheet.write(row, 2, _('Ref.'), col_title) + sheet.write(row, 3, _('Partner'), col_title) + sheet.write(row, 4, _('Amount'), col_title) + sheet.write(row, 5, _('Statement Ref.'), col_title) + 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.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 + 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', 'account.journal') diff --git a/account_bank_reconciliation_summary_xlsx/report/report.xml b/account_bank_reconciliation_summary_xlsx/report/report.xml new file mode 100644 index 00000000..c7cb9677 --- /dev/null +++ b/account_bank_reconciliation_summary_xlsx/report/report.xml @@ -0,0 +1,18 @@ + + + + + + + + diff --git a/account_bank_reconciliation_summary_xlsx/views/account_bank_statement_view.xml b/account_bank_reconciliation_summary_xlsx/views/account_bank_statement_view.xml new file mode 100644 index 00000000..e124089b --- /dev/null +++ b/account_bank_reconciliation_summary_xlsx/views/account_bank_statement_view.xml @@ -0,0 +1,23 @@ + + + + + + + + bank_rec_summary.account.bank.statement.form + account.bank.statement + + + + + + + + From b7bf2715ecb3645c83adaf7d88666296cea0b03f Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Fri, 9 Jun 2017 00:38:54 +0200 Subject: [PATCH 02/12] [FIX] Currency formatting with lang != en_US --- .../report/bank_reconciliation_xlsx.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py b/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py index 4e96c097..7c908ec2 100644 --- a/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py +++ b/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py @@ -44,11 +44,12 @@ class BankReconciliationXlsx(ReportXlsx): 'num_format': xls_date_format, 'font_size': 10, 'align': 'left'}) - cur_format = u'#%s##0%s00 %s' % ( - lang.thousands_sep or '', - lang.decimal_point or '', + 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({ From 2c07feb2d3386dff7e9652411779a1743d9e57a7 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Fri, 9 Jun 2017 00:42:27 +0200 Subject: [PATCH 03/12] Update module name and summary --- account_bank_reconciliation_summary_xlsx/__manifest__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/account_bank_reconciliation_summary_xlsx/__manifest__.py b/account_bank_reconciliation_summary_xlsx/__manifest__.py index 680a34e3..fc857293 100644 --- a/account_bank_reconciliation_summary_xlsx/__manifest__.py +++ b/account_bank_reconciliation_summary_xlsx/__manifest__.py @@ -3,12 +3,12 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { - 'name': 'Account Bank Statement Reconciliation Summary', + '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 statement reconciliation', + 'summary': 'Adds an XLSX report to help on bank reconciliation', 'depends': ['account', 'report_xlsx'], 'data': [ 'report/report.xml', From 9bb62974dafebd3c0800ab02256e5486c656bff9 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Sun, 29 Oct 2017 00:29:01 +0200 Subject: [PATCH 04/12] Support bank reconciliation summary on date != today Add wizard for that report --- .../__init__.py | 1 + .../__manifest__.py | 4 +- .../models/__init__.py | 1 + .../models/account_move_line.py | 13 +++++ .../report/bank_reconciliation_xlsx.py | 58 ++++++++++++------- ...nt_view.xml => account_bank_statement.xml} | 0 .../views/account_move_line.xml | 22 +++++++ .../wizard/__init__.py | 3 + .../bank_reconciliation_report_wizard.py | 41 +++++++++++++ ...bank_reconciliation_report_wizard_view.xml | 36 ++++++++++++ 10 files changed, 157 insertions(+), 22 deletions(-) create mode 100644 account_bank_reconciliation_summary_xlsx/models/account_move_line.py rename account_bank_reconciliation_summary_xlsx/views/{account_bank_statement_view.xml => account_bank_statement.xml} (100%) create mode 100644 account_bank_reconciliation_summary_xlsx/views/account_move_line.xml create mode 100644 account_bank_reconciliation_summary_xlsx/wizard/__init__.py create mode 100644 account_bank_reconciliation_summary_xlsx/wizard/bank_reconciliation_report_wizard.py create mode 100644 account_bank_reconciliation_summary_xlsx/wizard/bank_reconciliation_report_wizard_view.xml diff --git a/account_bank_reconciliation_summary_xlsx/__init__.py b/account_bank_reconciliation_summary_xlsx/__init__.py index 7a6c1b03..de9509a6 100644 --- a/account_bank_reconciliation_summary_xlsx/__init__.py +++ b/account_bank_reconciliation_summary_xlsx/__init__.py @@ -2,3 +2,4 @@ from . import models from . import report +from . import wizard diff --git a/account_bank_reconciliation_summary_xlsx/__manifest__.py b/account_bank_reconciliation_summary_xlsx/__manifest__.py index fc857293..0f25db90 100644 --- a/account_bank_reconciliation_summary_xlsx/__manifest__.py +++ b/account_bank_reconciliation_summary_xlsx/__manifest__.py @@ -12,7 +12,9 @@ 'depends': ['account', 'report_xlsx'], 'data': [ 'report/report.xml', - 'views/account_bank_statement_view.xml', + 'views/account_bank_statement.xml', + 'views/account_move_line.xml', + 'wizard/bank_reconciliation_report_wizard_view.xml', ], 'installable': True, } diff --git a/account_bank_reconciliation_summary_xlsx/models/__init__.py b/account_bank_reconciliation_summary_xlsx/models/__init__.py index ac116473..a7a3402d 100644 --- a/account_bank_reconciliation_summary_xlsx/models/__init__.py +++ b/account_bank_reconciliation_summary_xlsx/models/__init__.py @@ -1,3 +1,4 @@ # -*- coding: utf-8 -*- from . import account_bank_statement +from . import account_move_line diff --git a/account_bank_reconciliation_summary_xlsx/models/account_move_line.py b/account_bank_reconciliation_summary_xlsx/models/account_move_line.py new file mode 100644 index 00000000..21727012 --- /dev/null +++ b/account_bank_reconciliation_summary_xlsx/models/account_move_line.py @@ -0,0 +1,13 @@ +# -*- coding: utf-8 -*- +# © 2017 Akretion (Alexis de Lattre ) +# 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) diff --git a/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py b/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py index 7c908ec2..9eb12362 100644 --- a/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py +++ b/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py @@ -3,7 +3,7 @@ # 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 _ +from odoo import fields, _ from odoo.tools import DEFAULT_SERVER_DATE_FORMAT from datetime import datetime @@ -11,10 +11,22 @@ from datetime import datetime class BankReconciliationXlsx(ReportXlsx): def generate_xlsx_report(self, workbook, data, journals): + # I can't use fields.Date.context_today(self) + date = data.get('date') or datetime.today() + date_dt = fields.Date.from_string(date) no_bank_journal = True for o in journals.filtered(lambda o: o.type == 'bank'): 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', @@ -24,19 +36,16 @@ class BankReconciliationXlsx(ReportXlsx): '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}) - 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') if '%' in xls_date_format: # fallback xls_date_format = 'yyyy-mm-dd' @@ -71,10 +80,10 @@ class BankReconciliationXlsx(ReportXlsx): sheet.set_column(5, 5, 14) sheet.set_column(6, 6, 22) row = 2 - sheet.write(row, 0, _("Date:"), label_bold) - # I can't use fields.Date.context_today(self) - sheet.write(row, 1, datetime.today(), regular_date) + sheet.write(row, 0, _("Date:"), title_right) + sheet.write(row, 1, date_dt, title_date) # 1) Show accounting balance of bank account + row += 1 bank_account = o.default_debit_account_id sheet.write( row, 3, @@ -84,8 +93,8 @@ class BankReconciliationXlsx(ReportXlsx): # if not o.currency_id else 'amount_currency' query = """ SELECT sum(%s) FROM account_move_line - WHERE account_id=%%s""" % (amount_field,) - self.env.cr.execute(query, (bank_account.id,)) + 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 @@ -95,7 +104,8 @@ class BankReconciliationXlsx(ReportXlsx): 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 account + # 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, _( @@ -105,7 +115,9 @@ class BankReconciliationXlsx(ReportXlsx): mlines = self.env['account.move.line'].search([ ('account_id', '=', bank_account.id), ('journal_id', '=', o.id), # to avoid initial line - ('statement_id', '=', False)]) + ('date', '<=', date), + '|', ('statement_line_date', '=', False), + ('statement_line_date', '>', date)]) if not mlines: sheet.write(row, 4, _('NONE'), none) else: @@ -115,8 +127,9 @@ class BankReconciliationXlsx(ReportXlsx): sheet.write(row, 2, _('Ref.'), col_title) sheet.write(row, 3, _('Partner'), col_title) sheet.write(row, 4, _('Amount'), col_title) - sheet.write(row, 5, _('Move Number'), col_title) - sheet.write(row, 6, _('Counter-part'), col_title) + sheet.write(row, 5, _('Statement Line Date'), col_title) + sheet.write(row, 6, _('Move Number'), col_title) + sheet.write(row, 7, _('Counter-part'), col_title) m_start_row = m_end_row = row + 1 for mline in mlines: row += 1 @@ -131,7 +144,9 @@ class BankReconciliationXlsx(ReportXlsx): sheet.write( row, 3, mline.partner_id.display_name or '', regular) sheet.write(row, 4, mline.balance, regular_currency) - sheet.write(row, 5, move.name, regular) + sheet.write( + row, 5, mline.statement_line_date, regular_date) + sheet.write(row, 6, move.name, regular) # counter-part accounts cpart = [] for line in move.line_ids: @@ -139,7 +154,7 @@ class BankReconciliationXlsx(ReportXlsx): line.account_id != bank_account and line.account_id.code not in cpart): cpart.append(line.account_id.code) - sheet.write(row, 6, ' ,'.join(cpart), regular) + sheet.write(row, 7, ' ,'.join(cpart), regular) formula += '-SUM(E%d:E%d)' % (m_start_row + 1, m_end_row + 1) @@ -151,7 +166,8 @@ class BankReconciliationXlsx(ReportXlsx): label_bold) blines = self.env['account.bank.statement.line'].search([ ('journal_entry_ids', '=', False), - ('journal_id', '=', o.id)]) + ('journal_id', '=', o.id), + ('date', '<=', date)]) if not blines: sheet.write(row, 4, _('NONE'), none) else: diff --git a/account_bank_reconciliation_summary_xlsx/views/account_bank_statement_view.xml b/account_bank_reconciliation_summary_xlsx/views/account_bank_statement.xml similarity index 100% rename from account_bank_reconciliation_summary_xlsx/views/account_bank_statement_view.xml rename to account_bank_reconciliation_summary_xlsx/views/account_bank_statement.xml diff --git a/account_bank_reconciliation_summary_xlsx/views/account_move_line.xml b/account_bank_reconciliation_summary_xlsx/views/account_move_line.xml new file mode 100644 index 00000000..7e03af6c --- /dev/null +++ b/account_bank_reconciliation_summary_xlsx/views/account_move_line.xml @@ -0,0 +1,22 @@ + + + + + + + + bank_rec_summarry.account_move_line_form + account.move.line + + + + + + + + + + diff --git a/account_bank_reconciliation_summary_xlsx/wizard/__init__.py b/account_bank_reconciliation_summary_xlsx/wizard/__init__.py new file mode 100644 index 00000000..02696cfe --- /dev/null +++ b/account_bank_reconciliation_summary_xlsx/wizard/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import bank_reconciliation_report_wizard diff --git a/account_bank_reconciliation_summary_xlsx/wizard/bank_reconciliation_report_wizard.py b/account_bank_reconciliation_summary_xlsx/wizard/bank_reconciliation_report_wizard.py new file mode 100644 index 00000000..1370a98a --- /dev/null +++ b/account_bank_reconciliation_summary_xlsx/wizard/bank_reconciliation_report_wizard.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +# © 2017 Akretion (Alexis de Lattre ) +# 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'), + ('company_id', '=', self.env.user.company_id.id)]) + return journals + + company_id = fields.Many2one( + 'res.company', string='Company', + default=lambda self: self.env.user.company_id) + 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': 'account.journal', + 'ids': self.journal_ids.ids, + 'date': self.date, + }, + 'context': self._context, + } + return action diff --git a/account_bank_reconciliation_summary_xlsx/wizard/bank_reconciliation_report_wizard_view.xml b/account_bank_reconciliation_summary_xlsx/wizard/bank_reconciliation_report_wizard_view.xml new file mode 100644 index 00000000..841d8ff1 --- /dev/null +++ b/account_bank_reconciliation_summary_xlsx/wizard/bank_reconciliation_report_wizard_view.xml @@ -0,0 +1,36 @@ + + + + + + + bank.reconciliation.report.wizard.form + bank.reconciliation.report.wizard + +
+ + + + + +
+
+
+
+
+ + + Bank Reconciliation Report + bank.reconciliation.report.wizard + form + new + + + + +
From eb2b7999ff07c50c672fb921640e1b4acaabe7e2 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Sun, 29 Oct 2017 02:16:48 +0200 Subject: [PATCH 05/12] Fine tune layout bank reconciliation report Report is technically linked to wizard, not to account.journal --- .../__manifest__.py | 2 +- .../models/__init__.py | 1 - .../models/account_bank_statement.py | 22 ------- .../report/bank_reconciliation_xlsx.py | 61 +++++++++++-------- .../report/report.xml | 2 +- .../views/account_bank_statement.xml | 4 +- .../bank_reconciliation_report_wizard.py | 8 +-- ...bank_reconciliation_report_wizard_view.xml | 3 +- 8 files changed, 44 insertions(+), 59 deletions(-) delete mode 100644 account_bank_reconciliation_summary_xlsx/models/account_bank_statement.py diff --git a/account_bank_reconciliation_summary_xlsx/__manifest__.py b/account_bank_reconciliation_summary_xlsx/__manifest__.py index 0f25db90..97b80d32 100644 --- a/account_bank_reconciliation_summary_xlsx/__manifest__.py +++ b/account_bank_reconciliation_summary_xlsx/__manifest__.py @@ -12,9 +12,9 @@ 'depends': ['account', 'report_xlsx'], 'data': [ 'report/report.xml', + 'wizard/bank_reconciliation_report_wizard_view.xml', 'views/account_bank_statement.xml', 'views/account_move_line.xml', - 'wizard/bank_reconciliation_report_wizard_view.xml', ], 'installable': True, } diff --git a/account_bank_reconciliation_summary_xlsx/models/__init__.py b/account_bank_reconciliation_summary_xlsx/models/__init__.py index a7a3402d..0c1006db 100644 --- a/account_bank_reconciliation_summary_xlsx/models/__init__.py +++ b/account_bank_reconciliation_summary_xlsx/models/__init__.py @@ -1,4 +1,3 @@ # -*- coding: utf-8 -*- -from . import account_bank_statement from . import account_move_line diff --git a/account_bank_reconciliation_summary_xlsx/models/account_bank_statement.py b/account_bank_reconciliation_summary_xlsx/models/account_bank_statement.py deleted file mode 100644 index d43c4219..00000000 --- a/account_bank_reconciliation_summary_xlsx/models/account_bank_statement.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- coding: utf-8 -*- -# © 2017 Akretion France (Alexis de Lattre ) -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). - -from odoo import models - - -class AccountBankStatement(models.Model): - _inherit = 'account.bank.statement' - - def print_reconciliation_xlsx(self): - self.ensure_one() - action = { - 'type': 'ir.actions.report.xml', - 'report_name': 'bank.reconciliation.xlsx', - 'datas': { - 'model': 'account.journal', - 'ids': [self.journal_id.id], - }, - 'context': self._context, - } - return action diff --git a/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py b/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py index 9eb12362..b9ca49cd 100644 --- a/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py +++ b/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py @@ -10,12 +10,11 @@ from datetime import datetime class BankReconciliationXlsx(ReportXlsx): - def generate_xlsx_report(self, workbook, data, journals): - # I can't use fields.Date.context_today(self) - date = data.get('date') or datetime.today() + 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 journals.filtered(lambda o: o.type == 'bank'): + for o in wizard.journal_ids: no_bank_journal = False # Start styles lang_code = self.env.user.lang @@ -77,14 +76,17 @@ class BankReconciliationXlsx(ReportXlsx): sheet.set_column(2, 2, 15) sheet.set_column(3, 3, 25) sheet.set_column(4, 4, 12) - sheet.set_column(5, 5, 14) - sheet.set_column(6, 6, 22) + 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 += 1 + 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) @@ -122,30 +124,33 @@ class BankReconciliationXlsx(ReportXlsx): sheet.write(row, 4, _('NONE'), none) else: row += 1 - sheet.write(row, 0, _('Date'), col_title) - sheet.write(row, 1, _('Label'), col_title) - sheet.write(row, 2, _('Ref.'), col_title) - sheet.write(row, 3, _('Partner'), col_title) - sheet.write(row, 4, _('Amount'), col_title) - sheet.write(row, 5, _('Statement Line Date'), col_title) - sheet.write(row, 6, _('Move Number'), col_title) - sheet.write(row, 7, _('Counter-part'), col_title) + 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 = datetime.strptime( - mline.date, DEFAULT_SERVER_DATE_FORMAT) + 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) - sheet.write( - row, 5, mline.statement_line_date, regular_date) + 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 = [] @@ -172,12 +177,13 @@ class BankReconciliationXlsx(ReportXlsx): sheet.write(row, 4, _('NONE'), none) else: row += 1 - sheet.write(row, 0, _('Date'), col_title) - sheet.write(row, 1, _('Label'), col_title) - sheet.write(row, 2, _('Ref.'), col_title) - sheet.write(row, 3, _('Partner'), col_title) - sheet.write(row, 4, _('Amount'), col_title) - sheet.write(row, 5, _('Statement Ref.'), col_title) + 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 @@ -198,6 +204,8 @@ class BankReconciliationXlsx(ReportXlsx): # 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) @@ -214,4 +222,5 @@ class BankReconciliationXlsx(ReportXlsx): "This report is only for bank journals."), warn_msg) -BankReconciliationXlsx('report.bank.reconciliation.xlsx', 'account.journal') +BankReconciliationXlsx( + 'report.bank.reconciliation.xlsx', 'bank.reconciliation.report.wizard') diff --git a/account_bank_reconciliation_summary_xlsx/report/report.xml b/account_bank_reconciliation_summary_xlsx/report/report.xml index c7cb9677..8a855b44 100644 --- a/account_bank_reconciliation_summary_xlsx/report/report.xml +++ b/account_bank_reconciliation_summary_xlsx/report/report.xml @@ -8,7 +8,7 @@ diff --git a/account_bank_reconciliation_summary_xlsx/wizard/bank_reconciliation_report_wizard.py b/account_bank_reconciliation_summary_xlsx/wizard/bank_reconciliation_report_wizard.py index 1370a98a..9c887bd5 100644 --- a/account_bank_reconciliation_summary_xlsx/wizard/bank_reconciliation_report_wizard.py +++ b/account_bank_reconciliation_summary_xlsx/wizard/bank_reconciliation_report_wizard.py @@ -16,9 +16,6 @@ class BankReconciliationReportWizard(models.TransientModel): ('company_id', '=', self.env.user.company_id.id)]) return journals - company_id = fields.Many2one( - 'res.company', string='Company', - default=lambda self: self.env.user.company_id) date = fields.Date( required=True, default=fields.Date.context_today) @@ -32,8 +29,9 @@ class BankReconciliationReportWizard(models.TransientModel): 'type': 'ir.actions.report.xml', 'report_name': 'bank.reconciliation.xlsx', 'datas': { - 'model': 'account.journal', - 'ids': self.journal_ids.ids, + 'model': self._name, + 'ids': self.ids, + 'journal_ids': self.journal_ids.ids, 'date': self.date, }, 'context': self._context, diff --git a/account_bank_reconciliation_summary_xlsx/wizard/bank_reconciliation_report_wizard_view.xml b/account_bank_reconciliation_summary_xlsx/wizard/bank_reconciliation_report_wizard_view.xml index 841d8ff1..8ee3d6e6 100644 --- a/account_bank_reconciliation_summary_xlsx/wizard/bank_reconciliation_report_wizard_view.xml +++ b/account_bank_reconciliation_summary_xlsx/wizard/bank_reconciliation_report_wizard_view.xml @@ -6,13 +6,13 @@ + bank.reconciliation.report.wizard.form bank.reconciliation.report.wizard
- @@ -33,4 +33,5 @@ + From b52a044623fa0470f81d263dbaacb27e9fe093aa Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Sun, 29 Oct 2017 02:22:41 +0200 Subject: [PATCH 06/12] Put menu entry of Bank Reconciliation Report under OCA reports --- account_bank_reconciliation_summary_xlsx/README.rst | 5 ++--- account_bank_reconciliation_summary_xlsx/__manifest__.py | 2 +- .../wizard/bank_reconciliation_report_wizard_view.xml | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/account_bank_reconciliation_summary_xlsx/README.rst b/account_bank_reconciliation_summary_xlsx/README.rst index e0a3f6ee..fd4cb162 100644 --- a/account_bank_reconciliation_summary_xlsx/README.rst +++ b/account_bank_reconciliation_summary_xlsx/README.rst @@ -23,10 +23,9 @@ This module doesn't require any configuration. Usage ===== -You can get the Bank Reconciliation Report from: +You can launch the Bank Reconciliation Report wizard from: -* the form view of a bank bournal: click on *Print > Bank Reconciliation XLSX* -* the tree view of journals: select one or several journals and click on *Print > Bank Reconciliation XLSX* (if you selected several bank journals, you will get one tab per journal) +* 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 diff --git a/account_bank_reconciliation_summary_xlsx/__manifest__.py b/account_bank_reconciliation_summary_xlsx/__manifest__.py index 97b80d32..4ea8f420 100644 --- a/account_bank_reconciliation_summary_xlsx/__manifest__.py +++ b/account_bank_reconciliation_summary_xlsx/__manifest__.py @@ -9,7 +9,7 @@ 'author': "Akretion,Odoo Community Association (OCA)", 'website': 'http://www.akretion.com', 'summary': 'Adds an XLSX report to help on bank reconciliation', - 'depends': ['account', 'report_xlsx'], + 'depends': ['account_financial_report_qweb', 'report_xlsx'], 'data': [ 'report/report.xml', 'wizard/bank_reconciliation_report_wizard_view.xml', diff --git a/account_bank_reconciliation_summary_xlsx/wizard/bank_reconciliation_report_wizard_view.xml b/account_bank_reconciliation_summary_xlsx/wizard/bank_reconciliation_report_wizard_view.xml index 8ee3d6e6..13227916 100644 --- a/account_bank_reconciliation_summary_xlsx/wizard/bank_reconciliation_report_wizard_view.xml +++ b/account_bank_reconciliation_summary_xlsx/wizard/bank_reconciliation_report_wizard_view.xml @@ -25,13 +25,13 @@ - Bank Reconciliation Report + Bank Reconciliation bank.reconciliation.report.wizard form new - + From 2eaea61b18cae34acf0d19107d63ee250c4494e7 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Sun, 29 Oct 2017 12:32:08 +0100 Subject: [PATCH 07/12] =?UTF-8?q?Fix=20typo=20in=20README=20found=20by=20R?= =?UTF-8?q?apha=C3=ABl=20Valyi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- account_bank_reconciliation_summary_xlsx/README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/account_bank_reconciliation_summary_xlsx/README.rst b/account_bank_reconciliation_summary_xlsx/README.rst index fd4cb162..447639d4 100644 --- a/account_bank_reconciliation_summary_xlsx/README.rst +++ b/account_bank_reconciliation_summary_xlsx/README.rst @@ -13,7 +13,7 @@ This module adds a Bank Reconciliation Report in Odoo in XLSX format. For each b 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 erreor 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. +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 ============= From acdd859454d8c6ae3973eb26cd229c6d0ba3c5f0 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Sat, 24 Mar 2018 14:18:38 +0100 Subject: [PATCH 08/12] Access to Bank reconciliation report from accounting dashboard Code written during the Tryton conference at JDLL 2018 :) --- .../__manifest__.py | 1 + .../views/account_journal.xml | 31 +++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 account_bank_reconciliation_summary_xlsx/views/account_journal.xml diff --git a/account_bank_reconciliation_summary_xlsx/__manifest__.py b/account_bank_reconciliation_summary_xlsx/__manifest__.py index 4ea8f420..de9c9a43 100644 --- a/account_bank_reconciliation_summary_xlsx/__manifest__.py +++ b/account_bank_reconciliation_summary_xlsx/__manifest__.py @@ -15,6 +15,7 @@ 'wizard/bank_reconciliation_report_wizard_view.xml', 'views/account_bank_statement.xml', 'views/account_move_line.xml', + 'views/account_journal.xml', ], 'installable': True, } diff --git a/account_bank_reconciliation_summary_xlsx/views/account_journal.xml b/account_bank_reconciliation_summary_xlsx/views/account_journal.xml new file mode 100644 index 00000000..35c9d999 --- /dev/null +++ b/account_bank_reconciliation_summary_xlsx/views/account_journal.xml @@ -0,0 +1,31 @@ + + + + + + + + bank_reconciliation_summarry.account_journal_dashboard + account.journal + + + +
+
+ Report +
+ +
+
+
+
+ + +
From 935ca17ec61aea9db678c9df37001f4c749b1a74 Mon Sep 17 00:00:00 2001 From: Mourad EL HADJ MIMOUNE Date: Tue, 4 Dec 2018 16:29:45 +0100 Subject: [PATCH 09/12] [FIX] add fr.po & filter default journal by bank_account_id & usee statement.display_name --- .../i18n/fr.po | 216 ++++++++++++++++++ .../report/bank_reconciliation_xlsx.py | 2 +- .../bank_reconciliation_report_wizard.py | 4 +- 3 files changed, 220 insertions(+), 2 deletions(-) create mode 100644 account_bank_reconciliation_summary_xlsx/i18n/fr.po diff --git a/account_bank_reconciliation_summary_xlsx/i18n/fr.po b/account_bank_reconciliation_summary_xlsx/i18n/fr.po new file mode 100644 index 00000000..2cfe1d92 --- /dev/null +++ b/account_bank_reconciliation_summary_xlsx/i18n/fr.po @@ -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 "Report" +msgstr "Raport" + +#. 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 "Raport 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 "XLSX rapprochement bancaire" + +#. 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 calculé 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 "Lines 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 not liés à 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 pièce comptables" + +#. 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é" + diff --git a/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py b/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py index b9ca49cd..2e1fcd2d 100644 --- a/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py +++ b/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py @@ -198,7 +198,7 @@ class BankReconciliationXlsx(ReportXlsx): row, 3, bline.partner_id.display_name or '', regular) sheet.write(row, 4, bline.amount, regular_currency) sheet.write( - row, 5, bline.statement_id.name or '', + row, 5, bline.statement_id.display_name or '', regular_currency) formula += '+SUM(E%d:E%d)' % (b_start_row + 1, b_end_row + 1) diff --git a/account_bank_reconciliation_summary_xlsx/wizard/bank_reconciliation_report_wizard.py b/account_bank_reconciliation_summary_xlsx/wizard/bank_reconciliation_report_wizard.py index 9c887bd5..61040e2b 100644 --- a/account_bank_reconciliation_summary_xlsx/wizard/bank_reconciliation_report_wizard.py +++ b/account_bank_reconciliation_summary_xlsx/wizard/bank_reconciliation_report_wizard.py @@ -13,7 +13,9 @@ class BankReconciliationReportWizard(models.TransientModel): def _default_journal_ids(self): journals = self.env['account.journal'].search([ ('type', '=', 'bank'), - ('company_id', '=', self.env.user.company_id.id)]) + ('bank_account_id', '!=', False), + ('company_id', '=', self.env.user.company_id.id), + ]) return journals date = fields.Date( From 653c1bf7bbdb7b9fd9b76c41b1f09ac2224ac834 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Tue, 15 Jan 2019 17:13:03 +0100 Subject: [PATCH 10/12] Add company name in title of the XLSX report --- .../report/bank_reconciliation_xlsx.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py b/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py index 2e1fcd2d..635de784 100644 --- a/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py +++ b/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py @@ -67,7 +67,9 @@ class BankReconciliationXlsx(ReportXlsx): sheet = workbook.add_worksheet(o.code or o.name) sheet.write( - 0, 0, _('%s - Bank Reconciliation') % o.display_name, + 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) From 9945240057d48a640d16e3cbf179431b94aa1ea8 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Sat, 2 Mar 2019 15:26:05 +0100 Subject: [PATCH 11/12] Fix FR translation --- .../i18n/fr.po | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/account_bank_reconciliation_summary_xlsx/i18n/fr.po b/account_bank_reconciliation_summary_xlsx/i18n/fr.po index 2cfe1d92..e745e11e 100644 --- a/account_bank_reconciliation_summary_xlsx/i18n/fr.po +++ b/account_bank_reconciliation_summary_xlsx/i18n/fr.po @@ -24,7 +24,7 @@ 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 "Report" -msgstr "Raport" +msgstr "Rapport" #. module: account_bank_reconciliation_summary_xlsx #: code:addons/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py:129 @@ -55,7 +55,7 @@ msgstr "Rapprochement bancaire" #: 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 "Raport rapprochement bancaire" +msgstr "Rapport rapprochement bancaire" #. module: account_bank_reconciliation_summary_xlsx #: model:ir.model,name:account_bank_reconciliation_summary_xlsx.model_bank_reconciliation_report_wizard @@ -65,7 +65,7 @@ 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 "XLSX rapprochement bancaire" +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 @@ -76,7 +76,7 @@ msgstr "Annuler" #: 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 calculé du compte bancaire :" +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 @@ -106,7 +106,7 @@ msgstr "Date " #: code:addons/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py:83 #, python-format msgid "Date:" -msgstr "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 @@ -117,7 +117,7 @@ msgstr "Nom affiché" #: code:addons/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py:169 #, python-format msgid "Draft bank statement lines:" -msgstr "Lines non validées du relevé bancaire:" +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 @@ -138,7 +138,7 @@ msgstr "Écriture comptable" #: 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 not liés à une ligne de relevé bancaire :" +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 @@ -166,7 +166,7 @@ msgstr "Mis à jour le" #: code:addons/account_bank_reconciliation_summary_xlsx/report/bank_reconciliation_xlsx.py:129 #, python-format msgid "Move Number" -msgstr "Numéro pièce comptables" +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 From fe31d674fa3dde7e16080069b666490bc7a91dfd Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Tue, 29 Oct 2019 16:16:20 +0100 Subject: [PATCH 12/12] Remove unuseful code --- .../wizard/bank_reconciliation_report_wizard.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/account_bank_reconciliation_summary_xlsx/wizard/bank_reconciliation_report_wizard.py b/account_bank_reconciliation_summary_xlsx/wizard/bank_reconciliation_report_wizard.py index 61040e2b..92731692 100644 --- a/account_bank_reconciliation_summary_xlsx/wizard/bank_reconciliation_report_wizard.py +++ b/account_bank_reconciliation_summary_xlsx/wizard/bank_reconciliation_report_wizard.py @@ -33,8 +33,6 @@ class BankReconciliationReportWizard(models.TransientModel): 'datas': { 'model': self._name, 'ids': self.ids, - 'journal_ids': self.journal_ids.ids, - 'date': self.date, }, 'context': self._context, }