diff --git a/account_reconcile_restrict_partner_mismatch/README.rst b/account_reconcile_restrict_partner_mismatch/README.rst new file mode 100644 index 0000000000..39a8e12674 --- /dev/null +++ b/account_reconcile_restrict_partner_mismatch/README.rst @@ -0,0 +1,119 @@ +=================================== +Reconcile restrict partner mismatch +=================================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:893e295e519a93dd096174319fa89d25509ab7df53a313bf5cc93c2b98a6be42 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/18.0/account_reconcile_restrict_partner_mismatch + :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-18-0/account-reconcile-18-0-account_reconcile_restrict_partner_mismatch + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/account-reconcile&target_branch=18.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module restricts reconciliation between journal items when: + + - both items have different partners + - one item is with partner and the other without it + +This rule applies only for journal items using receivable and payable +account type. + +As at the moment of installation some journal items could have been +reconciled using different partners, you can detect them in menu +Accounting > Adviser > Reconciled items with partner mismatch. + +This restriction can be enabled per company but can also be deactivated +per journal. + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +- Go to Accounting > Configuration > Settings > Partners Mismatch + Restriction on Reconcile +- Check the box to activate the parameter. +- To deactivate the behavior on journal level, go to Accounting > + Configuration > Accounting > Journals +- In Advanced Settings > Partner Mismatch On Reconcile +- Check the box if you want to deactivate the restriction for that + journal entries. + +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 to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* Camptocamp + +Contributors +------------ + +- `Tecnativa `__: + + - Ernesto Tejeda + +- `Trobz `__: + + - Nguyen Ho + - Nhan Tran + +- `ACSONE SA `__: + + - Souheil Bejaoui + +Other credits +------------- + +The migration of this module from 13.0 to 14.0 was financially supported +The migration of this module from 16.0 to 18.0 was financially supported +by Camptocamp + +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_reconcile_restrict_partner_mismatch/__init__.py b/account_reconcile_restrict_partner_mismatch/__init__.py new file mode 100644 index 0000000000..51d8f52af0 --- /dev/null +++ b/account_reconcile_restrict_partner_mismatch/__init__.py @@ -0,0 +1 @@ +from . import models, report diff --git a/account_reconcile_restrict_partner_mismatch/__manifest__.py b/account_reconcile_restrict_partner_mismatch/__manifest__.py new file mode 100644 index 0000000000..70de0c0148 --- /dev/null +++ b/account_reconcile_restrict_partner_mismatch/__manifest__.py @@ -0,0 +1,21 @@ +# Copyright 2019 Camptocamp SA +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +{ + "name": "Reconcile restrict partner mismatch", + "summary": "Restrict reconciliation on receivable " + "and payable accounts to the same partner", + "version": "18.0.1.0.0", + "depends": ["account"], + "author": "Camptocamp, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/account-reconcile", + "category": "Finance", + "license": "AGPL-3", + "data": [ + "security/ir.model.access.csv", + "report/account_move_lines_report.xml", + "views/account_journal.xml", + "views/res_config_settings.xml", + ], + "installable": True, +} diff --git a/account_reconcile_restrict_partner_mismatch/i18n/account_reconcile_restrict_partner_mismatch.pot b/account_reconcile_restrict_partner_mismatch/i18n/account_reconcile_restrict_partner_mismatch.pot new file mode 100644 index 0000000000..a170765b2e --- /dev/null +++ b/account_reconcile_restrict_partner_mismatch/i18n/account_reconcile_restrict_partner_mismatch.pot @@ -0,0 +1,108 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_reconcile_restrict_partner_mismatch +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.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_reconcile_restrict_partner_mismatch +#: model:ir.model.fields,field_description:account_reconcile_restrict_partner_mismatch.field_account_reconcile_partner_mismatch_report__account_id +msgid "Account" +msgstr "" + +#. module: account_reconcile_restrict_partner_mismatch +#: model:ir.model,name:account_reconcile_restrict_partner_mismatch.model_account_reconcile_partner_mismatch_report +msgid "Account Reconcile Partner Mismatch Report" +msgstr "" + +#. module: account_reconcile_restrict_partner_mismatch +#: model:ir.model.fields,field_description:account_reconcile_restrict_partner_mismatch.field_account_reconcile_partner_mismatch_report__account_type +msgid "Account type" +msgstr "" + +#. module: account_reconcile_restrict_partner_mismatch +#: model:ir.model.fields,field_description:account_reconcile_restrict_partner_mismatch.field_account_reconcile_partner_mismatch_report__credit_amount +msgid "Credit amount" +msgstr "" + +#. module: account_reconcile_restrict_partner_mismatch +#: model:ir.model.fields,field_description:account_reconcile_restrict_partner_mismatch.field_account_reconcile_partner_mismatch_report__credit_move_id +msgid "Credit move" +msgstr "" + +#. module: account_reconcile_restrict_partner_mismatch +#: model:ir.model.fields,field_description:account_reconcile_restrict_partner_mismatch.field_account_reconcile_partner_mismatch_report__credit_partner_id +msgid "Credit partner" +msgstr "" + +#. module: account_reconcile_restrict_partner_mismatch +#: model:ir.model.fields,field_description:account_reconcile_restrict_partner_mismatch.field_account_reconcile_partner_mismatch_report__debit_amount +msgid "Debit amount" +msgstr "" + +#. module: account_reconcile_restrict_partner_mismatch +#: model:ir.model.fields,field_description:account_reconcile_restrict_partner_mismatch.field_account_reconcile_partner_mismatch_report__debit_move_id +msgid "Debit move" +msgstr "" + +#. module: account_reconcile_restrict_partner_mismatch +#: model:ir.model.fields,field_description:account_reconcile_restrict_partner_mismatch.field_account_reconcile_partner_mismatch_report__debit_partner_id +msgid "Debit partner" +msgstr "" + +#. module: account_reconcile_restrict_partner_mismatch +#: model:ir.model.fields,field_description:account_reconcile_restrict_partner_mismatch.field_account_move_line__display_name +#: model:ir.model.fields,field_description:account_reconcile_restrict_partner_mismatch.field_account_reconcile_partner_mismatch_report__display_name +msgid "Display Name" +msgstr "" + +#. module: account_reconcile_restrict_partner_mismatch +#: model:ir.model.fields,field_description:account_reconcile_restrict_partner_mismatch.field_account_reconcile_partner_mismatch_report__full_reconcile_id +msgid "Full Reconcile" +msgstr "" + +#. module: account_reconcile_restrict_partner_mismatch +#: model:ir.model.fields,field_description:account_reconcile_restrict_partner_mismatch.field_account_move_line__id +#: model:ir.model.fields,field_description:account_reconcile_restrict_partner_mismatch.field_account_reconcile_partner_mismatch_report__id +msgid "ID" +msgstr "" + +#. module: account_reconcile_restrict_partner_mismatch +#: model:ir.model,name:account_reconcile_restrict_partner_mismatch.model_account_move_line +msgid "Journal Item" +msgstr "" + +#. module: account_reconcile_restrict_partner_mismatch +#: model:ir.model.fields,field_description:account_reconcile_restrict_partner_mismatch.field_account_move_line____last_update +#: model:ir.model.fields,field_description:account_reconcile_restrict_partner_mismatch.field_account_reconcile_partner_mismatch_report____last_update +msgid "Last Modified on" +msgstr "" + +#. module: account_reconcile_restrict_partner_mismatch +#: model:ir.model.fields,field_description:account_reconcile_restrict_partner_mismatch.field_account_reconcile_partner_mismatch_report__partial_reconcile_id +msgid "Partial Reconcile" +msgstr "" + +#. module: account_reconcile_restrict_partner_mismatch +#: model:ir.actions.act_window,name:account_reconcile_restrict_partner_mismatch.action_account_reconcile_partner_mismatch_report +#: model:ir.ui.menu,name:account_reconcile_restrict_partner_mismatch.menu_account_reconcile_partner_mismatch_report +#: model_terms:ir.ui.view,arch_db:account_reconcile_restrict_partner_mismatch.account_reconcile_partner_mismatch_report_view_form +#: model_terms:ir.ui.view,arch_db:account_reconcile_restrict_partner_mismatch.view_account_move_reconciled_report_tree +msgid "Reconciled items with partner mismatch" +msgstr "" + +#. module: account_reconcile_restrict_partner_mismatch +#: code:addons/account_reconcile_restrict_partner_mismatch/models/account_move_line.py:0 +#, python-format +msgid "" +"The partner has to be the same on all lines for receivable and payable " +"accounts!" +msgstr "" diff --git a/account_reconcile_restrict_partner_mismatch/i18n/es.po b/account_reconcile_restrict_partner_mismatch/i18n/es.po new file mode 100644 index 0000000000..9c6b7e9b82 --- /dev/null +++ b/account_reconcile_restrict_partner_mismatch/i18n/es.po @@ -0,0 +1,114 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_reconcile_restrict_partner_mismatch +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2022-08-04 18:06+0000\n" +"Last-Translator: Luis D. Lafaurie \n" +"Language-Team: none\n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.3.2\n" + +#. module: account_reconcile_restrict_partner_mismatch +#: model:ir.model.fields,field_description:account_reconcile_restrict_partner_mismatch.field_account_reconcile_partner_mismatch_report__account_id +msgid "Account" +msgstr "Cuenta" + +#. module: account_reconcile_restrict_partner_mismatch +#: model:ir.model,name:account_reconcile_restrict_partner_mismatch.model_account_reconcile_partner_mismatch_report +msgid "Account Reconcile Partner Mismatch Report" +msgstr "" +"Informe sobre la falta de coincidencia de cuentas conciliadas de los socios" + +#. module: account_reconcile_restrict_partner_mismatch +#: model:ir.model.fields,field_description:account_reconcile_restrict_partner_mismatch.field_account_reconcile_partner_mismatch_report__account_type +msgid "Account type" +msgstr "Tipo de cuenta" + +#. module: account_reconcile_restrict_partner_mismatch +#: model:ir.model.fields,field_description:account_reconcile_restrict_partner_mismatch.field_account_reconcile_partner_mismatch_report__credit_amount +msgid "Credit amount" +msgstr "Importe del crédito" + +#. module: account_reconcile_restrict_partner_mismatch +#: model:ir.model.fields,field_description:account_reconcile_restrict_partner_mismatch.field_account_reconcile_partner_mismatch_report__credit_move_id +msgid "Credit move" +msgstr "Movimiento del crédito" + +#. module: account_reconcile_restrict_partner_mismatch +#: model:ir.model.fields,field_description:account_reconcile_restrict_partner_mismatch.field_account_reconcile_partner_mismatch_report__credit_partner_id +msgid "Credit partner" +msgstr "Socio del crédito" + +#. module: account_reconcile_restrict_partner_mismatch +#: model:ir.model.fields,field_description:account_reconcile_restrict_partner_mismatch.field_account_reconcile_partner_mismatch_report__debit_amount +msgid "Debit amount" +msgstr "Importe de débito" + +#. module: account_reconcile_restrict_partner_mismatch +#: model:ir.model.fields,field_description:account_reconcile_restrict_partner_mismatch.field_account_reconcile_partner_mismatch_report__debit_move_id +msgid "Debit move" +msgstr "Movimiento de débito" + +#. module: account_reconcile_restrict_partner_mismatch +#: model:ir.model.fields,field_description:account_reconcile_restrict_partner_mismatch.field_account_reconcile_partner_mismatch_report__debit_partner_id +msgid "Debit partner" +msgstr "Socio de débito" + +#. module: account_reconcile_restrict_partner_mismatch +#: model:ir.model.fields,field_description:account_reconcile_restrict_partner_mismatch.field_account_move_line__display_name +#: model:ir.model.fields,field_description:account_reconcile_restrict_partner_mismatch.field_account_reconcile_partner_mismatch_report__display_name +msgid "Display Name" +msgstr "Nombre de la pantalla" + +#. module: account_reconcile_restrict_partner_mismatch +#: model:ir.model.fields,field_description:account_reconcile_restrict_partner_mismatch.field_account_reconcile_partner_mismatch_report__full_reconcile_id +msgid "Full Reconcile" +msgstr "Conciliación completa" + +#. module: account_reconcile_restrict_partner_mismatch +#: model:ir.model.fields,field_description:account_reconcile_restrict_partner_mismatch.field_account_move_line__id +#: model:ir.model.fields,field_description:account_reconcile_restrict_partner_mismatch.field_account_reconcile_partner_mismatch_report__id +msgid "ID" +msgstr "Identificación" + +#. module: account_reconcile_restrict_partner_mismatch +#: model:ir.model,name:account_reconcile_restrict_partner_mismatch.model_account_move_line +msgid "Journal Item" +msgstr "Artículo del diario" + +#. module: account_reconcile_restrict_partner_mismatch +#: model:ir.model.fields,field_description:account_reconcile_restrict_partner_mismatch.field_account_move_line____last_update +#: model:ir.model.fields,field_description:account_reconcile_restrict_partner_mismatch.field_account_reconcile_partner_mismatch_report____last_update +msgid "Last Modified on" +msgstr "Ultima modificación en" + +#. module: account_reconcile_restrict_partner_mismatch +#: model:ir.model.fields,field_description:account_reconcile_restrict_partner_mismatch.field_account_reconcile_partner_mismatch_report__partial_reconcile_id +msgid "Partial Reconcile" +msgstr "Conciliación parcial" + +#. module: account_reconcile_restrict_partner_mismatch +#: model:ir.actions.act_window,name:account_reconcile_restrict_partner_mismatch.action_account_reconcile_partner_mismatch_report +#: model:ir.ui.menu,name:account_reconcile_restrict_partner_mismatch.menu_account_reconcile_partner_mismatch_report +#: model_terms:ir.ui.view,arch_db:account_reconcile_restrict_partner_mismatch.account_reconcile_partner_mismatch_report_view_form +#: model_terms:ir.ui.view,arch_db:account_reconcile_restrict_partner_mismatch.view_account_move_reconciled_report_tree +msgid "Reconciled items with partner mismatch" +msgstr "Artículos conciliados sin coincidencia de socio" + +#. module: account_reconcile_restrict_partner_mismatch +#: code:addons/account_reconcile_restrict_partner_mismatch/models/account_move_line.py:0 +#, python-format +msgid "" +"The partner has to be the same on all lines for receivable and payable " +"accounts!" +msgstr "" +"¡El socio tiene que ser el mismo en todas las líneas de cuentas por cobrar y " +"por pagar!" diff --git a/account_reconcile_restrict_partner_mismatch/i18n/es_AR.po b/account_reconcile_restrict_partner_mismatch/i18n/es_AR.po new file mode 100644 index 0000000000..9af7491dbc --- /dev/null +++ b/account_reconcile_restrict_partner_mismatch/i18n/es_AR.po @@ -0,0 +1,113 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_reconcile_restrict_partner_mismatch +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2021-11-15 01:36+0000\n" +"Last-Translator: Ignacio Buioli \n" +"Language-Team: none\n" +"Language: es_AR\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.3.2\n" + +#. module: account_reconcile_restrict_partner_mismatch +#: model:ir.model.fields,field_description:account_reconcile_restrict_partner_mismatch.field_account_reconcile_partner_mismatch_report__account_id +msgid "Account" +msgstr "Cuenta" + +#. module: account_reconcile_restrict_partner_mismatch +#: model:ir.model,name:account_reconcile_restrict_partner_mismatch.model_account_reconcile_partner_mismatch_report +msgid "Account Reconcile Partner Mismatch Report" +msgstr "Informe de Discrepancias de Contactos en la Conciliación de Cuentas" + +#. module: account_reconcile_restrict_partner_mismatch +#: model:ir.model.fields,field_description:account_reconcile_restrict_partner_mismatch.field_account_reconcile_partner_mismatch_report__account_type +msgid "Account type" +msgstr "Tipo de Cuenta" + +#. module: account_reconcile_restrict_partner_mismatch +#: model:ir.model.fields,field_description:account_reconcile_restrict_partner_mismatch.field_account_reconcile_partner_mismatch_report__credit_amount +msgid "Credit amount" +msgstr "Monto de crédito" + +#. module: account_reconcile_restrict_partner_mismatch +#: model:ir.model.fields,field_description:account_reconcile_restrict_partner_mismatch.field_account_reconcile_partner_mismatch_report__credit_move_id +msgid "Credit move" +msgstr "Movimiento de crédito" + +#. module: account_reconcile_restrict_partner_mismatch +#: model:ir.model.fields,field_description:account_reconcile_restrict_partner_mismatch.field_account_reconcile_partner_mismatch_report__credit_partner_id +msgid "Credit partner" +msgstr "Crédito del contacto" + +#. module: account_reconcile_restrict_partner_mismatch +#: model:ir.model.fields,field_description:account_reconcile_restrict_partner_mismatch.field_account_reconcile_partner_mismatch_report__debit_amount +msgid "Debit amount" +msgstr "Monto de débito" + +#. module: account_reconcile_restrict_partner_mismatch +#: model:ir.model.fields,field_description:account_reconcile_restrict_partner_mismatch.field_account_reconcile_partner_mismatch_report__debit_move_id +msgid "Debit move" +msgstr "Movimiento de débito" + +#. module: account_reconcile_restrict_partner_mismatch +#: model:ir.model.fields,field_description:account_reconcile_restrict_partner_mismatch.field_account_reconcile_partner_mismatch_report__debit_partner_id +msgid "Debit partner" +msgstr "Débito del contacto" + +#. module: account_reconcile_restrict_partner_mismatch +#: model:ir.model.fields,field_description:account_reconcile_restrict_partner_mismatch.field_account_move_line__display_name +#: model:ir.model.fields,field_description:account_reconcile_restrict_partner_mismatch.field_account_reconcile_partner_mismatch_report__display_name +msgid "Display Name" +msgstr "Mostrar Nombre" + +#. module: account_reconcile_restrict_partner_mismatch +#: model:ir.model.fields,field_description:account_reconcile_restrict_partner_mismatch.field_account_reconcile_partner_mismatch_report__full_reconcile_id +msgid "Full Reconcile" +msgstr "Conciliación Total" + +#. module: account_reconcile_restrict_partner_mismatch +#: model:ir.model.fields,field_description:account_reconcile_restrict_partner_mismatch.field_account_move_line__id +#: model:ir.model.fields,field_description:account_reconcile_restrict_partner_mismatch.field_account_reconcile_partner_mismatch_report__id +msgid "ID" +msgstr "ID" + +#. module: account_reconcile_restrict_partner_mismatch +#: model:ir.model,name:account_reconcile_restrict_partner_mismatch.model_account_move_line +msgid "Journal Item" +msgstr "Apunte Contable" + +#. module: account_reconcile_restrict_partner_mismatch +#: model:ir.model.fields,field_description:account_reconcile_restrict_partner_mismatch.field_account_move_line____last_update +#: model:ir.model.fields,field_description:account_reconcile_restrict_partner_mismatch.field_account_reconcile_partner_mismatch_report____last_update +msgid "Last Modified on" +msgstr "Última modificación en" + +#. module: account_reconcile_restrict_partner_mismatch +#: model:ir.model.fields,field_description:account_reconcile_restrict_partner_mismatch.field_account_reconcile_partner_mismatch_report__partial_reconcile_id +msgid "Partial Reconcile" +msgstr "Conciliación Parcial" + +#. module: account_reconcile_restrict_partner_mismatch +#: model:ir.actions.act_window,name:account_reconcile_restrict_partner_mismatch.action_account_reconcile_partner_mismatch_report +#: model:ir.ui.menu,name:account_reconcile_restrict_partner_mismatch.menu_account_reconcile_partner_mismatch_report +#: model_terms:ir.ui.view,arch_db:account_reconcile_restrict_partner_mismatch.account_reconcile_partner_mismatch_report_view_form +#: model_terms:ir.ui.view,arch_db:account_reconcile_restrict_partner_mismatch.view_account_move_reconciled_report_tree +msgid "Reconciled items with partner mismatch" +msgstr "Elementos conciliados con discrepancia del contacto" + +#. module: account_reconcile_restrict_partner_mismatch +#: code:addons/account_reconcile_restrict_partner_mismatch/models/account_move_line.py:0 +#, python-format +msgid "" +"The partner has to be the same on all lines for receivable and payable " +"accounts!" +msgstr "" +"¡El contacto tiene que ser el mismo en todas las líneas para cuentas por " +"cobrar y por pagar!" diff --git a/account_reconcile_restrict_partner_mismatch/models/__init__.py b/account_reconcile_restrict_partner_mismatch/models/__init__.py new file mode 100644 index 0000000000..f75ae75d1a --- /dev/null +++ b/account_reconcile_restrict_partner_mismatch/models/__init__.py @@ -0,0 +1,4 @@ +from . import account_move_line +from . import account_journal +from . import res_company +from . import res_config_settings diff --git a/account_reconcile_restrict_partner_mismatch/models/account_journal.py b/account_reconcile_restrict_partner_mismatch/models/account_journal.py new file mode 100644 index 0000000000..3e953a7c08 --- /dev/null +++ b/account_reconcile_restrict_partner_mismatch/models/account_journal.py @@ -0,0 +1,12 @@ +# Copyright 2024 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from odoo import fields, models + + +class AccountJournal(models.Model): + _inherit = "account.journal" + + no_restrict_partner_mismatch_on_reconcile = fields.Boolean( + help="Check this if you don't want to restrict partner " + "mismatch (several differents) on reconcile." + ) diff --git a/account_reconcile_restrict_partner_mismatch/models/account_move_line.py b/account_reconcile_restrict_partner_mismatch/models/account_move_line.py new file mode 100644 index 0000000000..ac048cdb57 --- /dev/null +++ b/account_reconcile_restrict_partner_mismatch/models/account_move_line.py @@ -0,0 +1,39 @@ +# Copyright 2019 Camptocamp SA +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +from odoo import models +from odoo.exceptions import UserError + + +class AccountMoveLine(models.Model): + _inherit = "account.move.line" + + @property + def _check_partner_mismatch_on_reconcile(self): + """ + Returns True if the partner mismatch check on reconcile should be done + """ + self.ensure_one() + return bool( + self.company_id.restrict_partner_mismatch_on_reconcile + and not self.journal_id.no_restrict_partner_mismatch_on_reconcile + and self.account_id.account_type + in ("asset_receivable", "liability_payable") + ) + + def _reconcile_plan(self, reconciliation_plan): + # to be consistent with parent method + if reconciliation_plan: + partners = set() + for lines in reconciliation_plan: + checked_lines = lines.filtered( + lambda line: line._check_partner_mismatch_on_reconcile + ) + partners.update(line.partner_id.id for line in checked_lines) + if len(partners) > 1: + raise UserError( + self.env._( + "The partner has to be the same on all" + " lines for receivable and payable accounts!" + ) + ) + return super()._reconcile_plan(reconciliation_plan) diff --git a/account_reconcile_restrict_partner_mismatch/models/res_company.py b/account_reconcile_restrict_partner_mismatch/models/res_company.py new file mode 100644 index 0000000000..c9e86ef2c4 --- /dev/null +++ b/account_reconcile_restrict_partner_mismatch/models/res_company.py @@ -0,0 +1,12 @@ +# Copyright 2024 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from odoo import fields, models + + +class ResCompany(models.Model): + _inherit = "res.company" + + restrict_partner_mismatch_on_reconcile = fields.Boolean( + help="Check this if you want to avoid partner mismatch" + " (several different partners) on reconciliation." + ) diff --git a/account_reconcile_restrict_partner_mismatch/models/res_config_settings.py b/account_reconcile_restrict_partner_mismatch/models/res_config_settings.py new file mode 100644 index 0000000000..ae748d039b --- /dev/null +++ b/account_reconcile_restrict_partner_mismatch/models/res_config_settings.py @@ -0,0 +1,12 @@ +# Copyright 2024 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from odoo import fields, models + + +class ResConfigSettings(models.TransientModel): + _inherit = "res.config.settings" + + restrict_partner_mismatch_on_reconcile = fields.Boolean( + related="company_id.restrict_partner_mismatch_on_reconcile", + readonly=False, + ) diff --git a/account_reconcile_restrict_partner_mismatch/pyproject.toml b/account_reconcile_restrict_partner_mismatch/pyproject.toml new file mode 100644 index 0000000000..4231d0cccb --- /dev/null +++ b/account_reconcile_restrict_partner_mismatch/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/account_reconcile_restrict_partner_mismatch/readme/CONFIGURE.md b/account_reconcile_restrict_partner_mismatch/readme/CONFIGURE.md new file mode 100644 index 0000000000..65425f1304 --- /dev/null +++ b/account_reconcile_restrict_partner_mismatch/readme/CONFIGURE.md @@ -0,0 +1,8 @@ +- Go to Accounting \> Configuration \> Settings \> Partners Mismatch + Restriction on Reconcile +- Check the box to activate the parameter. +- To deactivate the behavior on journal level, go to Accounting \> + Configuration \> Accounting \> Journals +- In Advanced Settings \> Partner Mismatch On Reconcile +- Check the box if you want to deactivate the restriction for that + journal entries. diff --git a/account_reconcile_restrict_partner_mismatch/readme/CONTRIBUTORS.md b/account_reconcile_restrict_partner_mismatch/readme/CONTRIBUTORS.md new file mode 100644 index 0000000000..1ecf6807e8 --- /dev/null +++ b/account_reconcile_restrict_partner_mismatch/readme/CONTRIBUTORS.md @@ -0,0 +1,7 @@ +- [Tecnativa](https://www.tecnativa.com): + - Ernesto Tejeda +- [Trobz](https://trobz.com): + - Nguyen Ho \<\> + - Nhan Tran \<\> +- [ACSONE SA](https://acsone.eu): + - Souheil Bejaoui \<\> diff --git a/account_reconcile_restrict_partner_mismatch/readme/CREDITS.md b/account_reconcile_restrict_partner_mismatch/readme/CREDITS.md new file mode 100644 index 0000000000..5dfda7ecbb --- /dev/null +++ b/account_reconcile_restrict_partner_mismatch/readme/CREDITS.md @@ -0,0 +1,3 @@ +The migration of this module from 13.0 to 14.0 was financially supported +The migration of this module from 16.0 to 18.0 was financially supported +by Camptocamp diff --git a/account_reconcile_restrict_partner_mismatch/readme/DESCRIPTION.md b/account_reconcile_restrict_partner_mismatch/readme/DESCRIPTION.md new file mode 100644 index 0000000000..a974842681 --- /dev/null +++ b/account_reconcile_restrict_partner_mismatch/readme/DESCRIPTION.md @@ -0,0 +1,14 @@ +This module restricts reconciliation between journal items when: + +> - both items have different partners +> - one item is with partner and the other without it + +This rule applies only for journal items using receivable and payable +account type. + +As at the moment of installation some journal items could have been +reconciled using different partners, you can detect them in menu +Accounting \> Adviser \> Reconciled items with partner mismatch. + +This restriction can be enabled per company but can also be deactivated +per journal. diff --git a/account_reconcile_restrict_partner_mismatch/report/__init__.py b/account_reconcile_restrict_partner_mismatch/report/__init__.py new file mode 100644 index 0000000000..f32b29ee8d --- /dev/null +++ b/account_reconcile_restrict_partner_mismatch/report/__init__.py @@ -0,0 +1 @@ +from . import report_reconciled_lines diff --git a/account_reconcile_restrict_partner_mismatch/report/account_move_lines_report.xml b/account_reconcile_restrict_partner_mismatch/report/account_move_lines_report.xml new file mode 100644 index 0000000000..fa294e3609 --- /dev/null +++ b/account_reconcile_restrict_partner_mismatch/report/account_move_lines_report.xml @@ -0,0 +1,69 @@ + + + + Reconciled items with partner mismatch + account.reconcile.partner.mismatch.report + + + + + + + + + + + + + + + + + + account.reconcile.partner.mismatch.report.form + account.reconcile.partner.mismatch.report + +
+ + + + + + + + + + + + + + + + + + +
+
+
+ + Reconciled items with partner mismatch + account.reconcile.partner.mismatch.report + list,form + + +
diff --git a/account_reconcile_restrict_partner_mismatch/report/report_reconciled_lines.py b/account_reconcile_restrict_partner_mismatch/report/report_reconciled_lines.py new file mode 100644 index 0000000000..57ab0f8124 --- /dev/null +++ b/account_reconcile_restrict_partner_mismatch/report/report_reconciled_lines.py @@ -0,0 +1,59 @@ +# Copyright 2019 Camptocamp SA +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + + +from odoo import fields, models, tools + + +class AccountReconcilePartnerMismatchReport(models.Model): + _name = "account.reconcile.partner.mismatch.report" + _description = "Account Reconcile Partner Mismatch Report" + _auto = False + + partial_reconcile_id = fields.Many2one( + "account.partial.reconcile", string="Partial Reconcile" + ) + full_reconcile_id = fields.Many2one("account.full.reconcile") + account_id = fields.Many2one("account.account", string="Account") + account_type = fields.Selection( + selection=[("asset_receivable", "Receivable"), ("liability_payable", "Payable")] + ) + debit_move_id = fields.Many2one("account.move.line", string="Debit move") + debit_amount = fields.Float("Debit amount") + debit_partner_id = fields.Many2one("res.partner", string="Debit partner") + credit_move_id = fields.Many2one("account.move.line", string="Credit move") + credit_amount = fields.Float("Credit amount") + credit_partner_id = fields.Many2one("res.partner", string="Credit partner") + + def init(self): + """Select lines which violate defined rules""" + tools.drop_view_if_exists(self.env.cr, self._table) + self._cr.execute( + f"""CREATE OR REPLACE VIEW {self._table} AS ( + SELECT pr.id id + , pr.id partial_reconcile_id + , pr.full_reconcile_id + , pr.debit_move_id + , daml.debit debit_amount + , aa.account_type + , daml.partner_id debit_partner_id + , daml.account_id account_id + , pr.credit_move_id + , caml.credit credit_amount + , caml.partner_id credit_partner_id + FROM account_partial_reconcile pr + LEFT JOIN account_move_line daml + ON daml.id = pr.debit_move_id + LEFT JOIN account_move_line caml + ON caml.id = pr.credit_move_id + LEFT JOIN account_account aa + ON daml.account_id = aa.id + WHERE aa.account_type IN ('asset_receivable', 'liability_payable') + AND (daml.partner_id <> caml.partner_id + OR (daml.partner_id IS NULL + AND caml.partner_id IS NOT NULL) + OR (caml.partner_id IS NULL + AND daml.partner_id IS NOT NULL)) + ) + """ + ) diff --git a/account_reconcile_restrict_partner_mismatch/security/ir.model.access.csv b/account_reconcile_restrict_partner_mismatch/security/ir.model.access.csv new file mode 100644 index 0000000000..8dea174ac2 --- /dev/null +++ b/account_reconcile_restrict_partner_mismatch/security/ir.model.access.csv @@ -0,0 +1,2 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_account_reconcile_partner_mismatch_report,access_account_reconcile_partner_mismatch_report,model_account_reconcile_partner_mismatch_report,account.group_account_user,1,0,0,0 diff --git a/account_reconcile_restrict_partner_mismatch/static/description/icon.png b/account_reconcile_restrict_partner_mismatch/static/description/icon.png new file mode 100644 index 0000000000..3a0328b516 Binary files /dev/null and b/account_reconcile_restrict_partner_mismatch/static/description/icon.png differ diff --git a/account_reconcile_restrict_partner_mismatch/static/description/index.html b/account_reconcile_restrict_partner_mismatch/static/description/index.html new file mode 100644 index 0000000000..9958cadbd9 --- /dev/null +++ b/account_reconcile_restrict_partner_mismatch/static/description/index.html @@ -0,0 +1,469 @@ + + + + + +Reconcile restrict partner mismatch + + + +
+

Reconcile restrict partner mismatch

+ + +

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

+

This module restricts reconciliation between journal items when:

+
+
    +
  • both items have different partners
  • +
  • one item is with partner and the other without it
  • +
+
+

This rule applies only for journal items using receivable and payable +account type.

+

As at the moment of installation some journal items could have been +reconciled using different partners, you can detect them in menu +Accounting > Adviser > Reconciled items with partner mismatch.

+

This restriction can be enabled per company but can also be deactivated +per journal.

+

Table of contents

+ +
+

Configuration

+
    +
  • Go to Accounting > Configuration > Settings > Partners Mismatch +Restriction on Reconcile
  • +
  • Check the box to activate the parameter.
  • +
  • To deactivate the behavior on journal level, go to Accounting > +Configuration > Accounting > Journals
  • +
  • In Advanced Settings > Partner Mismatch On Reconcile
  • +
  • Check the box if you want to deactivate the restriction for that +journal entries.
  • +
+
+
+

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 to smash it by providing a detailed and welcomed +feedback.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Camptocamp
  • +
+
+
+

Contributors

+ +
+
+

Other credits

+

The migration of this module from 13.0 to 14.0 was financially supported +The migration of this module from 16.0 to 18.0 was financially supported +by Camptocamp

+
+
+

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_reconcile_restrict_partner_mismatch/tests/__init__.py b/account_reconcile_restrict_partner_mismatch/tests/__init__.py new file mode 100644 index 0000000000..5eaab0190a --- /dev/null +++ b/account_reconcile_restrict_partner_mismatch/tests/__init__.py @@ -0,0 +1 @@ +from . import test_reconciliation diff --git a/account_reconcile_restrict_partner_mismatch/tests/test_reconciliation.py b/account_reconcile_restrict_partner_mismatch/tests/test_reconciliation.py new file mode 100644 index 0000000000..80f031758a --- /dev/null +++ b/account_reconcile_restrict_partner_mismatch/tests/test_reconciliation.py @@ -0,0 +1,170 @@ +# Copyright 2019 Camptocamp SA +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo.exceptions import UserError +from odoo.tests import tagged + +from odoo.addons.base.tests.common import BaseCommon + + +@tagged("-at_install", "post_install") +class TestReconciliation(BaseCommon): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.partner = cls.env.ref("base.res_partner_2") + cls.partner_id = cls.partner.id + cls.account_rcv = cls.env["account.account"].create( + { + "code": "RA1000", + "name": "Test Receivable Account", + "account_type": "asset_receivable", + "reconcile": True, + } + ) + cls.account_rsa = cls.env["account.account"].create( + { + "code": "PA1000", + "name": "Test Payable Account", + "account_type": "liability_payable", + "reconcile": True, + } + ) + cls.bank_journal = cls.env["account.journal"].create( + {"name": "Bank", "type": "bank", "code": "BNK67"} + ) + cls.aml = cls.init_moves() + + @classmethod + def create_move(cls, name, amount): + debit_line_vals = { + "name": name, + "debit": amount > 0 and amount or 0.0, + "credit": amount < 0 and -amount or 0.0, + "account_id": cls.account_rcv.id, + } + credit_line_vals = debit_line_vals.copy() + credit_line_vals["debit"] = debit_line_vals["credit"] + credit_line_vals["credit"] = debit_line_vals["debit"] + credit_line_vals["account_id"] = cls.account_rsa.id + vals = { + "journal_id": cls.bank_journal.id, + "line_ids": [(0, 0, debit_line_vals), (0, 0, credit_line_vals)], + } + return ( + cls.env["account.move"] + .with_context(default_journal_id=cls.bank_journal.id) + .create(vals) + .id + ) + + @classmethod + def init_moves(cls): + move_list_vals = [ + ("1", -1.83), + ("2", 728.35), + ("3", -4.46), + ("4", 0.32), + ("5", 14.72), + ("6", -737.10), + ] + move_ids = [] + for name, amount in move_list_vals: + move_ids.append(cls.create_move(name, amount)) + aml_recs = cls.env["account.move.line"].search( + [("move_id", "in", move_ids), ("account_id", "=", cls.account_rcv.id)] + ) + return aml_recs + + def test_reconcile_no_partner(self): + self.aml.move_id.action_post() + self.aml.reconcile() + self.assertTrue(all(self.aml.mapped("reconciled"))) + + def test_reconcile_partner_mismatch(self): + self.aml.move_id.company_id.restrict_partner_mismatch_on_reconcile = True + self.aml[0].partner_id = self.partner.id + self.aml.move_id.action_post() + with self.assertRaises(UserError) as exc: + self.aml.reconcile() + self.assertIn( + "The partner has to be the same on all lines " + "for receivable and payable accounts!", + exc.exception.args[0], + ) + # all lines with same partner allowed + self.aml.write({"partner_id": self.partner.id}) + # self.aml.move_id.action_post() + self.aml.reconcile() + self.assertTrue(all(self.aml.mapped("reconciled"))) + + def test_reconcile_partner_mismatch_deactivated(self): + # Check reconciliation is allowed if restriction is deactivated + self.aml[0].partner_id = self.partner.id + self.aml.move_id.action_post() + self.aml.reconcile() + self.aml.flush_recordset() + + self.env["account.reconcile.partner.mismatch.report"].init() + report = self.env["account.reconcile.partner.mismatch.report"].search([]) + self.assertTrue(report) + self.assertEqual(self.aml[0], report.credit_move_id) + + def test_reconcile_partner_mismatch_deactivated_on_journal(self): + # Check reconciliation is allowed if restriction is deactivated on journal level + self.aml.move_id.company_id.restrict_partner_mismatch_on_reconcile = True + self.aml.move_id.journal_id.no_restrict_partner_mismatch_on_reconcile = True + self.aml[0].partner_id = self.partner.id + self.aml.move_id.action_post() + self.aml.reconcile() + + def test_reconcile_accounts_excluded(self): + self.aml.move_id.company_id.restrict_partner_mismatch_on_reconcile = True + self.aml[0].partner_id = self.partner.id + with self.assertRaises(UserError) as exc: + self.aml.reconcile() + self.assertIn( + "The partner has to be the same on all lines " + "for receivable and payable accounts!", + exc.exception.args[0], + ) + # reconciliation forbiden only for certain types of accounts + account = self.env["account.account"].create( + { + "code": "CAA1000", + "name": "Test Current Assets Account", + "account_type": "asset_current", + "reconcile": True, + } + ) + # reconciliation for different partners allowed + # for not forbidden types + self.aml.write({"account_id": account.id}) + self.aml.move_id.action_post() + self.aml.reconcile() + self.assertTrue(all(self.aml.mapped("reconciled"))) + + def test_reconcile_same_partner(self): + """Test reconciliation of two move lines with same partner works.""" + self.aml.move_id.company_id.restrict_partner_mismatch_on_reconcile = True + # Set same partner for both lines + self.aml.write({"partner_id": self.partner.id}) + self.aml.move_id.action_post() + self.aml.reconcile() + self.assertTrue(all(self.aml.mapped("reconciled"))) + + def test_reconcile_different_journals(self): + """Test reconciliation works across different journals.""" + # Create second journal + cash_journal = self.env["account.journal"].create( + {"name": "Cash", "type": "cash", "code": "CSH67"} + ) + + # Update journals of existing moves + self.aml[0].move_id.journal_id = self.bank_journal + self.aml[1].move_id.journal_id = cash_journal + + # Test reconciliation + self.aml.move_id.action_post() + self.aml.reconcile() + self.assertTrue(all(self.aml.mapped("reconciled"))) diff --git a/account_reconcile_restrict_partner_mismatch/views/account_journal.xml b/account_reconcile_restrict_partner_mismatch/views/account_journal.xml new file mode 100644 index 0000000000..07580a6586 --- /dev/null +++ b/account_reconcile_restrict_partner_mismatch/views/account_journal.xml @@ -0,0 +1,22 @@ + + + + + account.journal + + + + + + + + + + diff --git a/account_reconcile_restrict_partner_mismatch/views/res_config_settings.xml b/account_reconcile_restrict_partner_mismatch/views/res_config_settings.xml new file mode 100644 index 0000000000..c6bb8e69c6 --- /dev/null +++ b/account_reconcile_restrict_partner_mismatch/views/res_config_settings.xml @@ -0,0 +1,25 @@ + + + + + res.config.settings.view.form + res.config.settings + + + + + + + + + + + +