From 7d2b13924cbff78fa37100aea7adf2a49761464f Mon Sep 17 00:00:00 2001 From: oleksandrpaziuk Date: Wed, 30 May 2018 16:45:35 +0300 Subject: [PATCH] [10.0] add account_bank_statement_line_reconciliation module --- .../README.rst | 95 +++++++++++++++++++ .../__init__.py | 5 + .../__manifest__.py | 21 ++++ .../wizard/__init__.py | 5 + ...nk_statement_line_reconciliation_wizard.py | 53 +++++++++++ ...k_statement_line_reconciliation_wizard.xml | 36 +++++++ 6 files changed, 215 insertions(+) create mode 100644 account_bank_statement_line_reconciliation/README.rst create mode 100644 account_bank_statement_line_reconciliation/__init__.py create mode 100644 account_bank_statement_line_reconciliation/__manifest__.py create mode 100644 account_bank_statement_line_reconciliation/wizard/__init__.py create mode 100644 account_bank_statement_line_reconciliation/wizard/account_bank_statement_line_reconciliation_wizard.py create mode 100644 account_bank_statement_line_reconciliation/wizard/account_bank_statement_line_reconciliation_wizard.xml diff --git a/account_bank_statement_line_reconciliation/README.rst b/account_bank_statement_line_reconciliation/README.rst new file mode 100644 index 00000000..f153321f --- /dev/null +++ b/account_bank_statement_line_reconciliation/README.rst @@ -0,0 +1,95 @@ +.. 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 + +========================================== +Account Bank Statement Line Reconciliation +========================================== + +The wizard provides the ability to specify bank statement line when it needed. +The only users from security group "Settings" can use it. + +Usage +===== + +This module is for you if you work with Odoo enterprise and you messed up the bank reconcile report. + +The bank reconciliation report is accessible from the hyperlink 'Difference' which appears on bank journals cards when the GL balance differs from the bank statement balance. + +There are only 2 situation handled from field filter (from bank reconcile view) but there are more in real life: + +1 - Blue lines appear if account_move_lines have these values: + +.. code-block:: python + + statement_id = false + AND payment_id = true + AND account_id = current bank + +-> This means that if you post a payment journal entry manually (meaning that you do not use the register payment button) the payment_id will not be populated then the payment_id will not be populated. When this happens, your entry won't match: you are stuck and you need this module to prevent this situation. + +Same issue in case of migration of payment entries with no payment_id + + +2 - If 1st request is not applicable then Odoo will look up for account_move_lines with: + +.. code-block:: python + + reconcile_id = false + account_id = flagged as 'Allow reconciliation" = true + excluding the line in the move with the bank account. + +-> This means that if you have created entries on a reconciliable account but you never reconcile it (ie: a cut-off entry or a correction) this line will appear forever in the list of possible matches -> so you may need this module to clean it up. + + +To use this module, you need to: + +#. Go to Accounting > Adviser > Journal Entries +#. Select one or more Journal Entry items +#. Press 'Action > Bank reconcile report change' +#. Select required value in 'New value' field. Leave empty if you want to set empty value. +#. Press 'Set value' + +By doing this, you will create/delete the link between Journal entry and bank statement lines hence you will make corrections on the bank reconcile report which would be impossible to do through the Odoo interface. + + + +.. 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 smash it by providing detailed and welcomed feedback. + +Credits +======= + +Images +------ + +* Odoo Community Association: `Icon `_. + +Contributors +------------ + +* Camptocamp SA + +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_statement_line_reconciliation/__init__.py b/account_bank_statement_line_reconciliation/__init__.py new file mode 100644 index 00000000..8ea5e68a --- /dev/null +++ b/account_bank_statement_line_reconciliation/__init__.py @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- +# Copyright 2018 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import wizard diff --git a/account_bank_statement_line_reconciliation/__manifest__.py b/account_bank_statement_line_reconciliation/__manifest__.py new file mode 100644 index 00000000..e9847fbc --- /dev/null +++ b/account_bank_statement_line_reconciliation/__manifest__.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Copyright 2018 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +{ + 'name': 'Account Bank Statement Line Reconciliation', + 'version': '10.0.1.0.0', + 'category': 'Accounting & Finance', + 'summary': 'OCA Financial Reports', + 'author': "Camptocamp, Odoo Community Association (OCA)", + 'website': 'https://github.com/OCA/account-financial-reporting', + 'license': 'AGPL-3', + 'depends': [ + 'account_accountant', + ], + 'data': [ + 'wizard/account_bank_statement_line_reconciliation_wizard.xml', + ], + 'installable': True, + 'application': False, +} diff --git a/account_bank_statement_line_reconciliation/wizard/__init__.py b/account_bank_statement_line_reconciliation/wizard/__init__.py new file mode 100644 index 00000000..fb367f55 --- /dev/null +++ b/account_bank_statement_line_reconciliation/wizard/__init__.py @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- +# Copyright 2018 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import account_bank_statement_line_reconciliation_wizard diff --git a/account_bank_statement_line_reconciliation/wizard/account_bank_statement_line_reconciliation_wizard.py b/account_bank_statement_line_reconciliation/wizard/account_bank_statement_line_reconciliation_wizard.py new file mode 100644 index 00000000..f08bef50 --- /dev/null +++ b/account_bank_statement_line_reconciliation/wizard/account_bank_statement_line_reconciliation_wizard.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# Copyright 2018 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import models, fields, api, _ +from odoo.exceptions import ValidationError + + +class AccountBankStatementLineReconciliationWizard(models.TransientModel): + _name = "account.bank.statement.line.reconciliation.wizard" + + statement_line_ids = fields.Many2many( + string='Current values', + comodel_name='account.bank.statement.line', + compute='_compute_statement_line_ids', + ) + new_statement_line_id = fields.Many2one( + string='New value', + comodel_name='account.bank.statement.line', + ) + + def _account_move_ids(self): + ids = self._context.get('active_ids') + account_move_ids = self.env['account.move'] + if ids: + account_move_ids = account_move_ids.browse(ids) + + journal_ids = account_move_ids.mapped('journal_id') + + if len(account_move_ids) > 1 and len(journal_ids) > 1: + msg = _("Please only select Journal entries " + "that belongs to the same bank journal") + raise ValidationError(msg) + + return account_move_ids + + def _compute_statement_line_ids(self): + for record in self: + account_move_ids = record._account_move_ids() + record.statement_line_ids = [ + (6, 0, account_move_ids.mapped('statement_line_id').ids), + ] + + @api.multi + def set_new_statement_line_value(self): + account_move_ids = self._account_move_ids() + account_move_ids.write({ + 'statement_line_id': self.new_statement_line_id.id, + }) + account_move_ids.mapped("line_ids").write({ + 'statement_id': self.new_statement_line_id.statement_id.id, + }) + return {} diff --git a/account_bank_statement_line_reconciliation/wizard/account_bank_statement_line_reconciliation_wizard.xml b/account_bank_statement_line_reconciliation/wizard/account_bank_statement_line_reconciliation_wizard.xml new file mode 100644 index 00000000..caf20d58 --- /dev/null +++ b/account_bank_statement_line_reconciliation/wizard/account_bank_statement_line_reconciliation_wizard.xml @@ -0,0 +1,36 @@ + + + + + + + Bank reconcile report change + account.bank.statement.line.reconciliation.wizard + +
+ + + + + + + + + + + +
+
+
+ +