Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
233 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 user from security group "Settings" can use it. | ||
|
||
Configuration | ||
============= | ||
|
||
No additional configuration required | ||
|
||
Usage | ||
===== | ||
|
||
This module is for you if you work on Odoo enterprise and if messed up the bank reconcile report. | ||
|
||
The bank reconciliation report is accessible from the hyperlink 'Difference' which apprears on bank journals cards when the GL balance differs from the bank statement balance. | ||
|
||
There are 2 SQL requests launched from field filter (from bank reconcile view) : | ||
|
||
1 - Blue lines appears if account_move_lines have these values: | ||
|
||
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 your entry will not be "match-able" → your are stuck -> so you need this module | ||
|
||
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: | ||
|
||
reconcile_id = false | ||
account_id = flagged as 'Allow reconciliation" = true | ||
excluding the line in the move with the bank account. | ||
-> This means that is 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 for ever in the list of possible match-> 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' | ||
|
||
Doing this, you will create/delete the link between Journal entry and bank statement lines so will make do corrctions on the bank reconcile report that 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 | ||
<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 smash it by providing detailed and welcomed feedback. | ||
|
||
Credits | ||
======= | ||
|
||
Images | ||
------ | ||
|
||
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_. | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
21 changes: 21 additions & 0 deletions
21
account_bank_statement_line_reconciliation/__manifest__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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, | ||
} |
5 changes: 5 additions & 0 deletions
5
account_bank_statement_line_reconciliation/wizard/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
71 changes: 71 additions & 0 deletions
71
...statement_line_reconciliation/wizard/account_bank_statement_line_reconciliation_wizard.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# -*- 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" | ||
|
||
def _account_move_ids_and_journal_id(self): | ||
ids = self._context.get('active_ids') | ||
account_move_ids = self.env['account.move'] | ||
account_move_line_ids = self.env['account.move.line'] | ||
journal_id = self.env['account.journal'] | ||
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) | ||
account_move_line_ids = account_move_ids.mapped('line_ids') | ||
journal_id = journal_ids[0] | ||
|
||
return account_move_ids, journal_id, account_move_line_ids | ||
|
||
def _default_statement_line_ids(self): | ||
account_move_ids, __, __ = self._account_move_ids_and_journal_id() | ||
return account_move_ids.mapped('statement_line_id') | ||
|
||
def _domain_new_statement_line_id(self): | ||
__, journal_id, __ = self._account_move_ids_and_journal_id() | ||
|
||
if journal_id: | ||
self.env.cr.execute(""" | ||
SELECT absl.id from account_bank_statement_line as absl | ||
JOIN account_bank_statement as acbs on acbs.id = absl.statement_id | ||
WHERE acbs.journal_id = %s;""", [journal_id.id]) | ||
statement_line_ids = [r[0] for r in self.env.cr.fetchall()] | ||
|
||
return "[('id','in',{ids})]".format(ids=statement_line_ids) | ||
return "[]" | ||
|
||
statement_line_ids = fields.One2many( | ||
'account.bank.statement.line', | ||
string=_('Current values'), | ||
default=_default_statement_line_ids, | ||
compute='_default_statement_line_ids' | ||
) | ||
|
||
new_statement_line_id = fields.Many2one( | ||
'account.bank.statement.line', | ||
string=_('New value'), | ||
domain=_domain_new_statement_line_id | ||
) | ||
|
||
@api.multi | ||
def set_new_statement_line_value(self): | ||
account_move_ids, __, account_move_line_ids = \ | ||
self._account_move_ids_and_journal_id() | ||
account_move_ids.write({ | ||
'statement_line_id': self.new_statement_line_id.id, | ||
}) | ||
account_move_line_ids.write({ | ||
'statement_id': self.new_statement_line_id.statement_id.id, | ||
}) | ||
return {} |
36 changes: 36 additions & 0 deletions
36
...tatement_line_reconciliation/wizard/account_bank_statement_line_reconciliation_wizard.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<odoo> | ||
|
||
<act_window id="action_account_bank_statement_line_reconciliation_wizard" | ||
name="Bank reconcile report change" | ||
src_model="account.move" | ||
res_model="account.bank.statement.line.reconciliation.wizard" | ||
view_mode="form" | ||
target="new" | ||
key2="client_action_multi" | ||
groups="base.group_system"/> | ||
|
||
<record id="account_bank_statement_line_reconciliation_wizard" model="ir.ui.view"> | ||
<field name="name">Bank reconcile report change</field> | ||
<field name="model">account.bank.statement.line.reconciliation.wizard</field> | ||
<field name="arch" type="xml"> | ||
<form string="Bank reconcile report change"> | ||
<sheet> | ||
<group> | ||
<field name="statement_line_ids"> | ||
<tree> | ||
<field name="name" string="Entry"/> | ||
</tree> | ||
</field> | ||
<field name="new_statement_line_id" options="{'no_create': True, 'no_create_edit': True}"/> | ||
</group> | ||
</sheet> | ||
<footer> | ||
<button string="Set value" name="set_new_statement_line_value" type="object" class="btn-primary"/> | ||
<button string="Cancel" class="btn-default" special="cancel" /> | ||
</footer> | ||
</form> | ||
</field> | ||
</record> | ||
|
||
</odoo> |