Bejaoui Souheil 2025-04-14 11:27:32 +00:00 committed by GitHub
commit ba0d1c6f79
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
27 changed files with 1356 additions and 0 deletions

View File

@ -0,0 +1,106 @@
===================================
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/16.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-16-0/account-reconcile-16-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=16.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 <https://github.com/OCA/account-reconcile/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 <https://github.com/OCA/account-reconcile/issues/new?body=module:%20account_reconcile_restrict_partner_mismatch%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues.
Credits
=======
Authors
~~~~~~~
* Camptocamp
Contributors
~~~~~~~~~~~~
* `Tecnativa <https://www.tecnativa.com>`_:
* Ernesto Tejeda
* `Trobz <https://trobz.com>`_:
* Nguyen Ho <nguyenhk@trobz.com>
* `ACSONE SA <https://acsone.eu>`_:
* Souheil Bejaoui <souheil.bejaoui@acsone.eu>
Other credits
~~~~~~~~~~~~~
The migration of this module from 13.0 to 14.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 <https://github.com/OCA/account-reconcile/tree/16.0/account_reconcile_restrict_partner_mismatch>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@ -0,0 +1 @@
from . import models, report

View File

@ -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": "16.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,
}

View File

@ -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 ""

View File

@ -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 <luislafaurie@hotmail.com>\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!"

View File

@ -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 <ibuioli@gmail.com>\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!"

View File

@ -0,0 +1,4 @@
from . import account_move_line
from . import account_journal
from . import res_company
from . import res_config_settings

View File

@ -0,0 +1,13 @@
# 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."
)

View File

@ -0,0 +1,38 @@
# 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(self):
# to be consistent with parent method
if self:
partners = set()
for line in self:
if line._check_partner_mismatch_on_reconcile:
partners.add(line.partner_id.id)
if len(partners) > 1:
raise UserError(
_(
"The partner has to be the same on all"
" lines for receivable and payable accounts!"
)
)
return super().reconcile()

View File

@ -0,0 +1,13 @@
# 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."
)

View File

@ -0,0 +1,13 @@
# 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,
)

View File

@ -0,0 +1,5 @@
- 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.

View File

@ -0,0 +1,6 @@
* `Tecnativa <https://www.tecnativa.com>`_:
* Ernesto Tejeda
* `Trobz <https://trobz.com>`_:
* Nguyen Ho <nguyenhk@trobz.com>
* `ACSONE SA <https://acsone.eu>`_:
* Souheil Bejaoui <souheil.bejaoui@acsone.eu>

View File

@ -0,0 +1 @@
The migration of this module from 13.0 to 14.0 was financially supported by Camptocamp

View File

@ -0,0 +1,12 @@
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.

View File

@ -0,0 +1 @@
from . import report_reconciled_lines

View File

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="view_account_move_reconciled_report_tree" model="ir.ui.view">
<field name="name">Reconciled items with partner mismatch</field>
<field name="model">account.reconcile.partner.mismatch.report</field>
<field name="arch" type="xml">
<tree create="false" delete="false" edit="false">
<!-- links are not clickable in tree view
only after open form view -->
<field name="partial_reconcile_id" />
<field name="full_reconcile_id" />
<field name="debit_move_id" />
<field name="debit_amount" />
<field name="debit_partner_id" />
<field name="credit_move_id" />
<field name="credit_amount" />
<field name="credit_partner_id" />
<field name="account_type" />
<field name="account_id" />
</tree>
</field>
</record>
<record id="account_reconcile_partner_mismatch_report_view_form" model="ir.ui.view">
<field name="name">account.reconcile.partner.mismatch.report.form</field>
<field name="model">account.reconcile.partner.mismatch.report</field>
<field name="arch" type="xml">
<form
string="Reconciled items with partner mismatch"
create="false"
delete="false"
edit="false"
>
<sheet>
<group>
<group>
<field name="partial_reconcile_id" />
<field name="full_reconcile_id" />
<field name="debit_amount" />
<field name="credit_amount" />
<field name="debit_partner_id" />
<field name="credit_partner_id" />
</group>
<group>
<field name="account_id" />
<field name="account_type" />
<field name="debit_move_id" />
<field name="credit_move_id" />
</group>
</group>
</sheet>
</form>
</field>
</record>
<record
id="action_account_reconcile_partner_mismatch_report"
model="ir.actions.act_window"
>
<field name="name">Reconciled items with partner mismatch</field>
<field name="res_model">account.reconcile.partner.mismatch.report</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem
id="menu_account_reconcile_partner_mismatch_report"
parent="account.menu_finance_entries"
sequence="80"
action="action_account_reconcile_partner_mismatch_report"
name="Reconciled items with partner mismatch"
/>
</odoo>

View File

@ -0,0 +1,60 @@
# 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(
"""CREATE OR REPLACE VIEW %s 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))
)
"""
% self._table
)

View File

@ -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
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 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

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

@ -0,0 +1,455 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
<title>Reconcile restrict partner mismatch</title>
<style type="text/css">
/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
margin-bottom: 0 ! important }
.hidden {
display: none }
.subscript {
vertical-align: sub;
font-size: smaller }
.superscript {
vertical-align: super;
font-size: smaller }
a.toc-backref {
text-decoration: none ;
color: black }
blockquote.epigraph {
margin: 2em 5em ; }
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
*/
div.abstract {
margin: 2em 5em }
div.abstract p.topic-title {
font-weight: bold ;
text-align: center }
div.admonition, div.attention, div.caution, div.danger, div.error,
div.hint, div.important, div.note, div.tip, div.warning {
margin: 2em ;
border: medium outset ;
padding: 1em }
div.admonition p.admonition-title, div.hint p.admonition-title,
div.important p.admonition-title, div.note p.admonition-title,
div.tip p.admonition-title {
font-weight: bold ;
font-family: sans-serif }
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title, .code .error {
color: red ;
font-weight: bold ;
font-family: sans-serif }
/* Uncomment (and remove this text!) to get reduced vertical space in
compound paragraphs.
div.compound .compound-first, div.compound .compound-middle {
margin-bottom: 0.5em }
div.compound .compound-last, div.compound .compound-middle {
margin-top: 0.5em }
*/
div.dedication {
margin: 2em 5em ;
text-align: center ;
font-style: italic }
div.dedication p.topic-title {
font-weight: bold ;
font-style: normal }
div.figure {
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
font-size: smaller }
div.line-block {
display: block ;
margin-top: 1em ;
margin-bottom: 1em }
div.line-block div.line-block {
margin-top: 0 ;
margin-bottom: 0 ;
margin-left: 1.5em }
div.sidebar {
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
width: 40% ;
float: right ;
clear: right }
div.sidebar p.rubric {
font-family: sans-serif ;
font-size: medium }
div.system-messages {
margin: 5em }
div.system-messages h1 {
color: red }
div.system-message {
border: medium outset ;
padding: 1em }
div.system-message p.system-message-title {
color: red ;
font-weight: bold }
div.topic {
margin: 2em }
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
margin-top: 0.4em }
h1.title {
text-align: center }
h2.subtitle {
text-align: center }
hr.docutils {
width: 75% }
img.align-left, .figure.align-left, object.align-left, table.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right, .figure.align-right, object.align-right, table.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
.align-top {
vertical-align: top }
.align-middle {
vertical-align: middle }
.align-bottom {
vertical-align: bottom }
ol.simple, ul.simple {
margin-bottom: 1em }
ol.arabic {
list-style: decimal }
ol.loweralpha {
list-style: lower-alpha }
ol.upperalpha {
list-style: upper-alpha }
ol.lowerroman {
list-style: lower-roman }
ol.upperroman {
list-style: upper-roman }
p.attribution {
text-align: right ;
margin-left: 50% }
p.caption {
font-style: italic }
p.credits {
font-style: italic ;
font-size: smaller }
p.label {
white-space: nowrap }
p.rubric {
font-weight: bold ;
font-size: larger ;
color: maroon ;
text-align: center }
p.sidebar-title {
font-family: sans-serif ;
font-weight: bold ;
font-size: larger }
p.sidebar-subtitle {
font-family: sans-serif ;
font-weight: bold }
p.topic-title {
font-weight: bold }
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font: inherit }
pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em }
pre.code .ln { color: gray; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier {
font-family: sans-serif ;
font-style: oblique }
span.classifier-delimiter {
font-family: sans-serif ;
font-weight: bold }
span.interpreted {
font-family: sans-serif }
span.option {
white-space: nowrap }
span.pre {
white-space: pre }
span.problematic, pre.problematic {
color: red }
span.section-subtitle {
/* font-size relative to parent (h1..h6 element) */
font-size: 80% }
table.citation {
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
table.docutils {
margin-top: 0.5em ;
margin-bottom: 0.5em }
table.footnote {
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
padding-left: 0.5em ;
padding-right: 0.5em ;
vertical-align: top }
table.docutils th.field-name, table.docinfo th.docinfo-name {
font-weight: bold ;
text-align: left ;
white-space: nowrap ;
padding-left: 0 }
/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
border: 0px;
border-top: 2px solid;
border-bottom: 2px solid;
border-collapse: collapse;
}
table.docutils.booktabs * {
border: 0px;
}
table.docutils.booktabs th {
border-bottom: thin solid;
text-align: left;
}
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
ul.auto-toc {
list-style-type: none }
</style>
</head>
<body>
<div class="document" id="reconcile-restrict-partner-mismatch">
<h1 class="title">Reconcile restrict partner mismatch</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:893e295e519a93dd096174319fa89d25509ab7df53a313bf5cc93c2b98a6be42
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/account-reconcile/tree/16.0/account_reconcile_restrict_partner_mismatch"><img alt="OCA/account-reconcile" src="https://img.shields.io/badge/github-OCA%2Faccount--reconcile-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/account-reconcile-16-0/account-reconcile-16-0-account_reconcile_restrict_partner_mismatch"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/account-reconcile&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module restricts reconciliation between journal items when:</p>
<blockquote>
<ul class="simple">
<li>both items have different partners</li>
<li>one item is with partner and the other without it</li>
</ul>
</blockquote>
<p>This rule applies only for journal items using receivable and payable account type.</p>
<p>As at the moment of installation some journal items could have been reconciled
using different partners, you can detect them in menu Accounting &gt; Adviser &gt;
Reconciled items with partner mismatch.</p>
<p>This restriction can be enabled per company but can also be deactivated per journal.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#configuration" id="toc-entry-1">Configuration</a></li>
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-2">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="toc-entry-3">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="toc-entry-4">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="toc-entry-5">Contributors</a></li>
<li><a class="reference internal" href="#other-credits" id="toc-entry-6">Other credits</a></li>
<li><a class="reference internal" href="#maintainers" id="toc-entry-7">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="configuration">
<h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
<ul class="simple">
<li>Go to Accounting &gt; Configuration &gt; Settings &gt; Partners Mismatch Restriction on Reconcile</li>
<li>Check the box to activate the parameter.</li>
<li>To deactivate the behavior on journal level, go to Accounting &gt; Configuration &gt; Accounting &gt; Journals</li>
<li>In Advanced Settings &gt; Partner Mismatch On Reconcile</li>
<li>Check the box if you want to deactivate the restriction for that journal entries.</li>
</ul>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/account-reconcile/issues">GitHub Issues</a>.
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
<a class="reference external" href="https://github.com/OCA/account-reconcile/issues/new?body=module:%20account_reconcile_restrict_partner_mismatch%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h1><a class="toc-backref" href="#toc-entry-3">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#toc-entry-4">Authors</a></h2>
<ul class="simple">
<li>Camptocamp</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
<ul class="simple">
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:
* Ernesto Tejeda</li>
<li><a class="reference external" href="https://trobz.com">Trobz</a>:
* Nguyen Ho &lt;<a class="reference external" href="mailto:nguyenhk&#64;trobz.com">nguyenhk&#64;trobz.com</a>&gt;</li>
<li><a class="reference external" href="https://acsone.eu">ACSONE SA</a>:
* Souheil Bejaoui &lt;<a class="reference external" href="mailto:souheil.bejaoui&#64;acsone.eu">souheil.bejaoui&#64;acsone.eu</a>&gt;</li>
</ul>
</div>
<div class="section" id="other-credits">
<h2><a class="toc-backref" href="#toc-entry-6">Other credits</a></h2>
<p>The migration of this module from 13.0 to 14.0 was financially supported by Camptocamp</p>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<p>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.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/account-reconcile/tree/16.0/account_reconcile_restrict_partner_mismatch">OCA/account-reconcile</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1 @@
from . import test_reconciliation

View File

@ -0,0 +1,141 @@
# Copyright 2019 Camptocamp SA
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo.exceptions import UserError
from odoo.addons.base.tests.common import BaseCommon
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")))

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2024 ACSONE SA/V
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>
<record id="view_account_journal_form" model="ir.ui.view">
<field name="model">account.journal</field>
<field name="inherit_id" ref="account.view_account_journal_form" />
<field name="arch" type="xml">
<xpath
expr="//field[@name='sale_activity_type_id']/parent::group"
position="after"
>
<group
string="Partner Mismatch on Reconcile"
name="partner_mismatch_reconcile"
>
<field name="no_restrict_partner_mismatch_on_reconcile" />
</group>
</xpath>
</field>
</record>
</odoo>

View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2024 ACSONE SA/V
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>
<record id="res_config_settings_view_form" model="ir.ui.view">
<field name="name">res.config.settings.view.form</field>
<field name="model">res.config.settings</field>
<field name="inherit_id" ref="account.res_config_settings_view_form" />
<field name="arch" type="xml">
<div id="quick_edit_mode" position="after">
<h2>Partners Mismatch Restriction on Reconcile</h2>
<div class="row mt16 o_settings_container" id="quick_edit_mode">
<div class="col-12 col-lg-12 o_setting_box">
<div class="o_setting_left_pane mt16">
<div>
<field name="restrict_partner_mismatch_on_reconcile" />
</div>
</div>
<div class="o_setting_right_pane mt16">
<label for="restrict_partner_mismatch_on_reconcile" />
<div class="text-muted">
Check this if you want to avoid partner mismatch (several different partners) on reconciliation.
</div>
</div>
</div>
</div>
</div>
</field>
</record>
</odoo>

View File

@ -0,0 +1 @@
../../../../account_reconcile_restrict_partner_mismatch

View File

@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)