diff --git a/account_bank_statement_reopen_skip_undo_reconciliation/README.rst b/account_bank_statement_reopen_skip_undo_reconciliation/README.rst new file mode 100644 index 00000000..a9928a18 --- /dev/null +++ b/account_bank_statement_reopen_skip_undo_reconciliation/README.rst @@ -0,0 +1,89 @@ +====================================================== +Account Bank Statement Reopen Skip Undo Reconciliation +====================================================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--reconcile-lightgray.png?logo=github + :target: https://github.com/OCA/account-reconcile/tree/14.0/account_bank_statement_reopen_skip_undo_reconciliation + :alt: OCA/account-reconcile +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/account-reconcile-14-0/account-reconcile-14-0-account_bank_statement_reopen_skip_undo_reconciliation + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/98/14.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +After installing this module when you press the button "Reset to New" on a bank +statement that is in status 'Processing' the application will not unreconcile +or set to draft any previous reconciled bank statement lines. + +The reconciled bank statement lines remain posted and reconciled. As soon as +you manually unreconcile the line the associated journal entry will be reset +back to the Draft status, if the statement is in "New" status. + +This feature improves the usability of the bank statements, as it may be +frequent for a user to adjust the statement lines during the reconciliation +process, needing to Reset the status of the statement back to new in order to +introduce changes. + +**Table of contents** + +.. contents:: + :local: + +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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* ForgeFlow +* Akretion + +Contributors +~~~~~~~~~~~~ + +* Akretion + * Alexis de Lattre + +* ForgeFlow + * Jordi Ballester Alomar + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +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. + +This module is part of the `OCA/account-reconcile `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/account_bank_statement_reopen_skip_undo_reconciliation/__init__.py b/account_bank_statement_reopen_skip_undo_reconciliation/__init__.py new file mode 100644 index 00000000..0650744f --- /dev/null +++ b/account_bank_statement_reopen_skip_undo_reconciliation/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/account_bank_statement_reopen_skip_undo_reconciliation/__manifest__.py b/account_bank_statement_reopen_skip_undo_reconciliation/__manifest__.py new file mode 100644 index 00000000..4b46671a --- /dev/null +++ b/account_bank_statement_reopen_skip_undo_reconciliation/__manifest__.py @@ -0,0 +1,20 @@ +# Copyright 2022 ForgeFlow S.L. +# @author Jordi Ballester +# Copyright 2022 Akretion (http://www.akretion.com) +# @author Alexis de Lattre +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +{ + "name": "Account Bank Statement Reopen Skip Undo Reconciliation", + "summary": "When reopening a bank statement it will respect the " + "reconciled entries.", + "version": "15.0.1.0.0", + "author": "ForgeFlow, Akretion, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/account-reconcile", + "category": "Finance", + "depends": ["account"], + "data": ["views/account_bank_statement_views.xml"], + "license": "AGPL-3", + "installable": True, + "auto_install": False, +} diff --git a/account_bank_statement_reopen_skip_undo_reconciliation/i18n/account_bank_statement_reopen_skip_undo_reconciliation.pot b/account_bank_statement_reopen_skip_undo_reconciliation/i18n/account_bank_statement_reopen_skip_undo_reconciliation.pot new file mode 100644 index 00000000..529eee67 --- /dev/null +++ b/account_bank_statement_reopen_skip_undo_reconciliation/i18n/account_bank_statement_reopen_skip_undo_reconciliation.pot @@ -0,0 +1,58 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_bank_statement_reopen_skip_undo_reconciliation +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 15.0\n" +"Report-Msgid-Bugs-To: \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_statement_reopen_skip_undo_reconciliation +#: model:ir.model,name:account_bank_statement_reopen_skip_undo_reconciliation.model_account_bank_statement +msgid "Bank Statement" +msgstr "" + +#. module: account_bank_statement_reopen_skip_undo_reconciliation +#: model:ir.model,name:account_bank_statement_reopen_skip_undo_reconciliation.model_account_bank_statement_line +msgid "Bank Statement Line" +msgstr "" + +#. module: account_bank_statement_reopen_skip_undo_reconciliation +#: model:ir.model.fields,field_description:account_bank_statement_reopen_skip_undo_reconciliation.field_account_bank_statement__display_name +#: model:ir.model.fields,field_description:account_bank_statement_reopen_skip_undo_reconciliation.field_account_bank_statement_line__display_name +#: model:ir.model.fields,field_description:account_bank_statement_reopen_skip_undo_reconciliation.field_account_move__display_name +#: model:ir.model.fields,field_description:account_bank_statement_reopen_skip_undo_reconciliation.field_account_move_line__display_name +msgid "Display Name" +msgstr "" + +#. module: account_bank_statement_reopen_skip_undo_reconciliation +#: model:ir.model.fields,field_description:account_bank_statement_reopen_skip_undo_reconciliation.field_account_bank_statement__id +#: model:ir.model.fields,field_description:account_bank_statement_reopen_skip_undo_reconciliation.field_account_bank_statement_line__id +#: model:ir.model.fields,field_description:account_bank_statement_reopen_skip_undo_reconciliation.field_account_move__id +#: model:ir.model.fields,field_description:account_bank_statement_reopen_skip_undo_reconciliation.field_account_move_line__id +msgid "ID" +msgstr "" + +#. module: account_bank_statement_reopen_skip_undo_reconciliation +#: model:ir.model,name:account_bank_statement_reopen_skip_undo_reconciliation.model_account_move +msgid "Journal Entry" +msgstr "" + +#. module: account_bank_statement_reopen_skip_undo_reconciliation +#: model:ir.model,name:account_bank_statement_reopen_skip_undo_reconciliation.model_account_move_line +msgid "Journal Item" +msgstr "" + +#. module: account_bank_statement_reopen_skip_undo_reconciliation +#: model:ir.model.fields,field_description:account_bank_statement_reopen_skip_undo_reconciliation.field_account_bank_statement____last_update +#: model:ir.model.fields,field_description:account_bank_statement_reopen_skip_undo_reconciliation.field_account_bank_statement_line____last_update +#: model:ir.model.fields,field_description:account_bank_statement_reopen_skip_undo_reconciliation.field_account_move____last_update +#: model:ir.model.fields,field_description:account_bank_statement_reopen_skip_undo_reconciliation.field_account_move_line____last_update +msgid "Last Modified on" +msgstr "" diff --git a/account_bank_statement_reopen_skip_undo_reconciliation/models/__init__.py b/account_bank_statement_reopen_skip_undo_reconciliation/models/__init__.py new file mode 100644 index 00000000..efbd6ab5 --- /dev/null +++ b/account_bank_statement_reopen_skip_undo_reconciliation/models/__init__.py @@ -0,0 +1,4 @@ +from . import account_bank_statement +from . import account_bank_statement_line +from . import account_move_line +from . import account_move diff --git a/account_bank_statement_reopen_skip_undo_reconciliation/models/account_bank_statement.py b/account_bank_statement_reopen_skip_undo_reconciliation/models/account_bank_statement.py new file mode 100644 index 00000000..d92b44f9 --- /dev/null +++ b/account_bank_statement_reopen_skip_undo_reconciliation/models/account_bank_statement.py @@ -0,0 +1,15 @@ +# Copyright 2022 Akretion (http://www.akretion.com) +# @author Alexis de Lattre +# Copyright 2022 ForgeFlow S.L. +# @author Jordi Ballester +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo import models + + +class AccountBankStatement(models.Model): + _inherit = "account.bank.statement" + + def button_reopen(self): + self = self.with_context(skip_undo_reconciliation=True) + return super(AccountBankStatement, self).button_reopen() diff --git a/account_bank_statement_reopen_skip_undo_reconciliation/models/account_bank_statement_line.py b/account_bank_statement_reopen_skip_undo_reconciliation/models/account_bank_statement_line.py new file mode 100644 index 00000000..3e4f5510 --- /dev/null +++ b/account_bank_statement_reopen_skip_undo_reconciliation/models/account_bank_statement_line.py @@ -0,0 +1,20 @@ +# Copyright 2022 Akretion (http://www.akretion.com) +# @author Alexis de Lattre +# Copyright 2022 ForgeFlow S.L. +# @author Jordi Ballester +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + + +from odoo import models + + +class AccountBankStatementLine(models.Model): + _inherit = "account.bank.statement.line" + + def button_undo_reconciliation(self): + if self._context.get("skip_undo_reconciliation"): + return + res = super(AccountBankStatementLine, self).button_undo_reconciliation() + if self.statement_id.state == "open": + self.move_id.button_draft() + return res diff --git a/account_bank_statement_reopen_skip_undo_reconciliation/models/account_move.py b/account_bank_statement_reopen_skip_undo_reconciliation/models/account_move.py new file mode 100644 index 00000000..5fbfabd6 --- /dev/null +++ b/account_bank_statement_reopen_skip_undo_reconciliation/models/account_move.py @@ -0,0 +1,13 @@ +# Copyright 2022 ForgeFlow S.L. +# @author Jordi Ballester +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo import models + + +class AccountMove(models.Model): + _inherit = "account.move" + + def button_draft(self): + moves_to_draft = self.filtered(lambda m: not m.statement_line_id.is_reconciled) + return super(AccountMove, moves_to_draft).button_draft() diff --git a/account_bank_statement_reopen_skip_undo_reconciliation/models/account_move_line.py b/account_bank_statement_reopen_skip_undo_reconciliation/models/account_move_line.py new file mode 100644 index 00000000..db1445e7 --- /dev/null +++ b/account_bank_statement_reopen_skip_undo_reconciliation/models/account_move_line.py @@ -0,0 +1,14 @@ +# Copyright 2022 ForgeFlow S.L. +# @author Jordi Ballester +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo import models + + +class AccountMoveLine(models.Model): + _inherit = "account.move.line" + + def remove_move_reconcile(self): + if self._context.get("skip_undo_reconciliation"): + return True + return super(AccountMoveLine, self).remove_move_reconcile() diff --git a/account_bank_statement_reopen_skip_undo_reconciliation/readme/CONTRIBUTORS.rst b/account_bank_statement_reopen_skip_undo_reconciliation/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000..7d73f962 --- /dev/null +++ b/account_bank_statement_reopen_skip_undo_reconciliation/readme/CONTRIBUTORS.rst @@ -0,0 +1,5 @@ +* Akretion + * Alexis de Lattre + +* ForgeFlow + * Jordi Ballester Alomar diff --git a/account_bank_statement_reopen_skip_undo_reconciliation/readme/DESCRIPTION.rst b/account_bank_statement_reopen_skip_undo_reconciliation/readme/DESCRIPTION.rst new file mode 100644 index 00000000..450d5a31 --- /dev/null +++ b/account_bank_statement_reopen_skip_undo_reconciliation/readme/DESCRIPTION.rst @@ -0,0 +1,12 @@ +After installing this module when you press the button "Reset to New" on a bank +statement that is in status 'Processing' the application will not unreconcile +or set to draft any previous reconciled bank statement lines. + +The reconciled bank statement lines remain posted and reconciled. As soon as +you manually unreconcile the line the associated journal entry will be reset +back to the Draft status, if the statement is in "New" status. + +This feature improves the usability of the bank statements, as it may be +frequent for a user to adjust the statement lines during the reconciliation +process, needing to Reset the status of the statement back to new in order to +introduce changes. diff --git a/account_bank_statement_reopen_skip_undo_reconciliation/static/description/icon.png b/account_bank_statement_reopen_skip_undo_reconciliation/static/description/icon.png new file mode 100644 index 00000000..3a0328b5 Binary files /dev/null and b/account_bank_statement_reopen_skip_undo_reconciliation/static/description/icon.png differ diff --git a/account_bank_statement_reopen_skip_undo_reconciliation/static/description/index.html b/account_bank_statement_reopen_skip_undo_reconciliation/static/description/index.html new file mode 100644 index 00000000..90a9574e --- /dev/null +++ b/account_bank_statement_reopen_skip_undo_reconciliation/static/description/index.html @@ -0,0 +1,444 @@ + + + + + + +Account Bank Statement Reopen Skip Undo Reconciliation + + + +
+

Account Bank Statement Reopen Skip Undo Reconciliation

+ + +

Beta License: AGPL-3 OCA/account-reconcile Translate me on Weblate Try me on Runbot

+

After installing this module when you press the button “Reset to New” on a bank +statement that is in status ‘Processing’ the application will not unreconcile +or set to draft any previous reconciled bank statement lines.

+

The reconciled bank statement lines remain posted and reconciled. As soon as +you manually unreconcile the line the associated journal entry will be reset +back to the Draft status, if the statement is in “New” status.

+

This feature improves the usability of the bank statements, as it may be +frequent for a user to adjust the statement lines during the reconciliation +process, needing to Reset the status of the statement back to new in order to +introduce changes.

+

Table of contents

+ +
+

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.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • ForgeFlow
  • +
  • Akretion
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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.

+

This module is part of the OCA/account-reconcile project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/account_bank_statement_reopen_skip_undo_reconciliation/tests/__init__.py b/account_bank_statement_reopen_skip_undo_reconciliation/tests/__init__.py new file mode 100644 index 00000000..33a86128 --- /dev/null +++ b/account_bank_statement_reopen_skip_undo_reconciliation/tests/__init__.py @@ -0,0 +1 @@ +from . import test_account_bank_statement diff --git a/account_bank_statement_reopen_skip_undo_reconciliation/tests/test_account_bank_statement.py b/account_bank_statement_reopen_skip_undo_reconciliation/tests/test_account_bank_statement.py new file mode 100644 index 00000000..539aefd7 --- /dev/null +++ b/account_bank_statement_reopen_skip_undo_reconciliation/tests/test_account_bank_statement.py @@ -0,0 +1,83 @@ +# Copyright 2022 ForgeFlow S.L. +# @author Jordi Ballester +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +from odoo import fields +from odoo.tests import tagged + +from odoo.addons.account.tests.test_account_bank_statement import ( + TestAccountBankStatementCommon, +) + + +@tagged("post_install", "-at_install") +class TestAccountBankStatementLine(TestAccountBankStatementCommon): + def test_button_undo_reconciliation(self): + statement = self.env["account.bank.statement"].create( + { + "name": "test_statement", + "date": "2019-01-01", + "journal_id": self.bank_journal_2.id, + "line_ids": [ + ( + 0, + 0, + { + "date": "2019-01-01", + "payment_ref": "line_1", + "partner_id": self.partner_a.id, + "amount": 1000, + }, + ), + ( + 0, + 0, + { + "date": "2019-01-01", + "payment_ref": "line_2", + "partner_id": self.partner_a.id, + "amount": 2000, + }, + ), + ], + } + ) + statement_line = statement.line_ids[0] + + test_invoice = self.env["account.move"].create( + [ + { + "move_type": "out_invoice", + "invoice_date": fields.Date.from_string("2016-01-01"), + "date": fields.Date.from_string("2016-01-01"), + "partner_id": self.partner_a.id, + "invoice_line_ids": [ + ( + 0, + None, + { + "name": "counterpart line, same amount", + "account_id": self.company_data[ + "default_account_revenue" + ].id, + "quantity": 1, + "price_unit": 1000, + }, + ), + ], + } + ] + ) + test_invoice.action_post() + statement.button_post() + counterpart_lines = test_invoice.mapped("line_ids").filtered( + lambda line: line.account_internal_type in ("receivable", "payable") + ) + statement_line.reconcile([{"id": counterpart_lines[0].id}]) + self.assertEqual(counterpart_lines.reconciled, True) + statement.button_reopen() + self.assertEqual(counterpart_lines.reconciled, True) + self.assertEqual(statement_line.move_id.state, "posted") + second_statement_line = statement.line_ids[0] + self.assertEqual(second_statement_line.move_id.state, "draft") + statement_line.button_undo_reconciliation() + self.assertEqual(statement_line.move_id.state, "draft") diff --git a/account_bank_statement_reopen_skip_undo_reconciliation/views/account_bank_statement_views.xml b/account_bank_statement_reopen_skip_undo_reconciliation/views/account_bank_statement_views.xml new file mode 100644 index 00000000..cdea9a4f --- /dev/null +++ b/account_bank_statement_reopen_skip_undo_reconciliation/views/account_bank_statement_views.xml @@ -0,0 +1,16 @@ + + + + account.bank.statement.form + account.bank.statement + + 1 + + + + + diff --git a/setup/account_bank_statement_reopen_skip_undo_reconciliation/odoo/addons/account_bank_statement_reopen_skip_undo_reconciliation b/setup/account_bank_statement_reopen_skip_undo_reconciliation/odoo/addons/account_bank_statement_reopen_skip_undo_reconciliation new file mode 120000 index 00000000..a587f984 --- /dev/null +++ b/setup/account_bank_statement_reopen_skip_undo_reconciliation/odoo/addons/account_bank_statement_reopen_skip_undo_reconciliation @@ -0,0 +1 @@ +../../../../account_bank_statement_reopen_skip_undo_reconciliation \ No newline at end of file diff --git a/setup/account_bank_statement_reopen_skip_undo_reconciliation/setup.py b/setup/account_bank_statement_reopen_skip_undo_reconciliation/setup.py new file mode 100644 index 00000000..28c57bb6 --- /dev/null +++ b/setup/account_bank_statement_reopen_skip_undo_reconciliation/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)