[16.0][MIG] account_reconcile_restrict_partner_mismatch

pull/596/head
sbejaoui 2023-09-29 15:23:09 +02:00
parent 337f898683
commit d79fd0dd12
13 changed files with 51 additions and 32 deletions

View File

@ -2,10 +2,13 @@
Reconcile restrict partner mismatch
===================================
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:e643e776a13ac74578f05aa23fc0328120234f43ff74182e837e0d18e2f357ae
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
@ -14,16 +17,16 @@ Reconcile restrict partner mismatch
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--reconcile-lightgray.png?logo=github
:target: https://github.com/OCA/account-reconcile/tree/14.0/account_reconcile_restrict_partner_mismatch
: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-14-0/account-reconcile-14-0-account_reconcile_restrict_partner_mismatch
: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/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/98/14.0
:alt: Try me on Runbot
.. |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|
|badge1| |badge2| |badge3| |badge4| |badge5|
This module restricts reconciliation between journal items when:
@ -46,8 +49,8 @@ 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 smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/account-reconcile/issues/new?body=module:%20account_reconcile_restrict_partner_mismatch%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
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.
@ -66,6 +69,8 @@ Contributors
* Ernesto Tejeda
* `Trobz <https://trobz.com>`_:
* Nguyen Ho <nguyenhk@trobz.com>
* `ACSONE SA <https://acsone.eu>`_:
* Souheil Bejaoui <souheil.bejaoui@acsone.eu>
Other credits
~~~~~~~~~~~~~
@ -85,6 +90,6 @@ 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/14.0/account_reconcile_restrict_partner_mismatch>`_ project on GitHub.
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

@ -5,7 +5,7 @@
"name": "Reconcile restrict partner mismatch",
"summary": "Restrict reconciliation on receivable "
"and payable accounts to the same partner",
"version": "15.0.1.0.0",
"version": "16.0.1.0.0",
"depends": ["account"],
"author": "Camptocamp, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/account-reconcile",

View File

@ -24,7 +24,7 @@ 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_id
#: model:ir.model.fields,field_description:account_reconcile_restrict_partner_mismatch.field_account_reconcile_partner_mismatch_report__account_type
msgid "Account type"
msgstr ""

View File

@ -28,7 +28,7 @@ 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_id
#: 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"

View File

@ -27,7 +27,7 @@ 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_id
#: 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"

View File

@ -18,7 +18,10 @@ class AccountMoveLine(models.Model):
return True
partners = set()
for line in self:
if line.account_id.internal_type in ("receivable", "payable"):
if line.account_id.account_type in (
"asset_receivable",
"liability_payable",
):
partners.add(line.partner_id.id)
if len(partners) > 1:
raise UserError(

View File

@ -2,3 +2,5 @@
* Ernesto Tejeda
* `Trobz <https://trobz.com>`_:
* Nguyen Ho <nguyenhk@trobz.com>
* `ACSONE SA <https://acsone.eu>`_:
* Souheil Bejaoui <souheil.bejaoui@acsone.eu>

View File

@ -15,7 +15,7 @@
<field name="credit_move_id" />
<field name="credit_amount" />
<field name="credit_partner_id" />
<field name="account_type_id" />
<field name="account_type" />
<field name="account_id" />
</tree>
</field>
@ -42,7 +42,7 @@
</group>
<group>
<field name="account_id" />
<field name="account_type_id" />
<field name="account_type" />
<field name="debit_move_id" />
<field name="credit_move_id" />
</group>

View File

@ -15,7 +15,9 @@ class AccountReconcilePartnerMismatchReport(models.Model):
)
full_reconcile_id = fields.Many2one("account.full.reconcile")
account_id = fields.Many2one("account.account", string="Account")
account_type_id = fields.Many2one("account.account.type", string="Account type")
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")
@ -33,7 +35,7 @@ class AccountReconcilePartnerMismatchReport(models.Model):
, pr.full_reconcile_id
, pr.debit_move_id
, daml.debit debit_amount
, aat.id account_type_id
, aa.account_type
, daml.partner_id debit_partner_id
, daml.account_id account_id
, pr.credit_move_id
@ -46,9 +48,7 @@ class AccountReconcilePartnerMismatchReport(models.Model):
ON caml.id = pr.credit_move_id
LEFT JOIN account_account aa
ON daml.account_id = aa.id
LEFT JOIN account_account_type aat
ON aa.user_type_id = aat.id
WHERE aat.type in ('receivable', 'payable')
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)

View File

@ -3,7 +3,7 @@
<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 0.15.1: http://docutils.sourceforge.net/" />
<meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
<title>Reconcile restrict partner mismatch</title>
<style type="text/css">
@ -366,8 +366,10 @@ ul.auto-toc {
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:e643e776a13ac74578f05aa23fc0328120234f43ff74182e837e0d18e2f357ae
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" 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" 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" href="https://github.com/OCA/account-reconcile/tree/14.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" href="https://translation.odoo-community.org/projects/account-reconcile-14-0/account-reconcile-14-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" href="https://runbot.odoo-community.org/runbot/98/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external" 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" 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" 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" 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" 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">
@ -396,8 +398,8 @@ Reconciled items with partner mismatch.</p>
<h1><a class="toc-backref" href="#id1">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 smashing 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:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
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">
@ -415,6 +417,8 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
* 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">
@ -428,7 +432,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<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/14.0/account_reconcile_restrict_partner_mismatch">OCA/account-reconcile</a> project on GitHub.</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>

View File

@ -20,7 +20,7 @@ class TestReconciliation(TransactionCase):
{
"code": "RA1000",
"name": "Test Receivable Account",
"user_type_id": cls.env.ref("account.data_account_type_receivable").id,
"account_type": "asset_receivable",
"reconcile": True,
}
)
@ -28,7 +28,7 @@ class TestReconciliation(TransactionCase):
{
"code": "PA1000",
"name": "Test Payable Account",
"user_type_id": cls.env.ref("account.data_account_type_payable").id,
"account_type": "liability_payable",
"reconcile": True,
}
)
@ -102,9 +102,7 @@ class TestReconciliation(TransactionCase):
{
"code": "CAA1000",
"name": "Test Current Assets Account",
"user_type_id": self.env.ref(
"account.data_account_type_current_assets"
).id,
"account_type": "asset_current",
"reconcile": True,
}
)

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,
)