Skip to content

Commit

Permalink
[IMP] account_reconcile_restrict_partner_mismatch: pre-commit auto fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukas Tran committed Dec 5, 2024
1 parent 79e91b7 commit 6a2b8f6
Show file tree
Hide file tree
Showing 16 changed files with 110 additions and 77 deletions.
64 changes: 38 additions & 26 deletions account_reconcile_restrict_partner_mismatch/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,31 @@ 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/16.0/account_reconcile_restrict_partner_mismatch
: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-16-0/account-reconcile-16-0-account_reconcile_restrict_partner_mismatch
: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=16.0
: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
- 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.
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.
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.
This restriction can be enabled per company but can also be deactivated
per journal.

**Table of contents**

Expand All @@ -49,47 +51,57 @@ This restriction can be enabled per company but can also be deactivated per jour
Configuration
=============

- Go to Accounting > Configuration > Settings > Partners Mismatch Restriction on Reconcile
- 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
- 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.
- 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**>`_.
`feedback <https://github.com/OCA/account-reconcile/issues/new?body=module:%20account_reconcile_restrict_partner_mismatch%0Aversion:%2018.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>
- `Tecnativa <https://www.tecnativa.com>`__:

- Ernesto Tejeda

- `Trobz <https://trobz.com>`__:

- Nguyen Ho <nguyenhk@trobz.com>
- Nhan Tran <nhant@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
The migration of this module from 13.0 to 14.0 was financially supported
by Camptocamp

Maintainers
~~~~~~~~~~~
-----------

This module is maintained by the OCA.

Expand All @@ -101,6 +113,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/16.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/18.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.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"name": "Reconcile restrict partner mismatch",
"summary": "Restrict reconciliation on receivable "
"and payable accounts to the same partner",
"version": "16.0.1.0.0",
"version": "18.0.1.0.0",
"depends": ["account"],
"author": "Camptocamp, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/account-reconcile",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class AccountJournal(models.Model):

_inherit = "account.journal"

no_restrict_partner_mismatch_on_reconcile = fields.Boolean(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class ResCompany(models.Model):

_inherit = "res.company"

restrict_partner_mismatch_on_reconcile = fields.Boolean(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class ResConfigSettings(models.TransientModel):

_inherit = "res.config.settings"

restrict_partner_mismatch_on_reconcile = fields.Boolean(
Expand Down
3 changes: 3 additions & 0 deletions account_reconcile_restrict_partner_mismatch/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
Original file line number Diff line number Diff line change
@@ -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.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
- [Tecnativa](https://www.tecnativa.com):
- Ernesto Tejeda
- [Trobz](https://trobz.com):
- Nguyen Ho \<<nguyenhk@trobz.com>\>
- Nhan Tran \<<nhant@trobz.com>\>
- [ACSONE SA](https://acsone.eu):
- Souheil Bejaoui \<<souheil.bejaoui@acsone.eu>\>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
The migration of this module from 13.0 to 14.0 was financially supported by Camptocamp
The migration of this module from 13.0 to 14.0 was financially supported
by Camptocamp
14 changes: 14 additions & 0 deletions account_reconcile_restrict_partner_mismatch/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -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.
12 changes: 0 additions & 12 deletions account_reconcile_restrict_partner_mismatch/readme/DESCRIPTION.rst

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ 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 (
f"""CREATE OR REPLACE VIEW {self._table} AS (
SELECT pr.id id
, pr.id partial_reconcile_id
, pr.full_reconcile_id
Expand All @@ -55,6 +55,5 @@ def init(self):
OR (caml.partner_id IS NULL
AND daml.partner_id IS NOT NULL))
)
"""
% self._table
"""
)
Original file line number Diff line number Diff line change
Expand Up @@ -369,19 +369,21 @@ <h1 class="title">Reconcile restrict partner mismatch</h1>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! 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><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/18.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-18-0/account-reconcile-18-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=18.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>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">
Expand All @@ -399,19 +401,22 @@ <h1 class="title">Reconcile restrict partner mismatch</h1>
<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>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>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>
<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>
<a class="reference external" href="https://github.com/OCA/account-reconcile/issues/new?body=module:%20account_reconcile_restrict_partner_mismatch%0Aversion:%2018.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">
Expand All @@ -425,17 +430,25 @@ <h2><a class="toc-backref" href="#toc-entry-4">Authors</a></h2>
<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>
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
<li>Ernesto Tejeda</li>
</ul>
</li>
<li><a class="reference external" href="https://trobz.com">Trobz</a>:<ul>
<li>Nguyen Ho &lt;<a class="reference external" href="mailto:nguyenhk&#64;trobz.com">nguyenhk&#64;trobz.com</a>&gt;</li>
<li>Nhan Tran &lt;<a class="reference external" href="mailto:nhant&#64;trobz.com">nhant&#64;trobz.com</a>&gt;</li>
</ul>
</li>
<li><a class="reference external" href="https://acsone.eu">ACSONE SA</a>:<ul>
<li>Souheil Bejaoui &lt;<a class="reference external" href="mailto:souheil.bejaoui&#64;acsone.eu">souheil.bejaoui&#64;acsone.eu</a>&gt;</li>
</ul>
</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>
<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>
Expand All @@ -446,7 +459,7 @@ <h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
<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>This module is part of the <a class="reference external" href="https://github.com/OCA/account-reconcile/tree/18.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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ def test_reconcile_partner_mismatch(self):
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!",
"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
Expand Down Expand Up @@ -121,7 +122,8 @@ def test_reconcile_accounts_excluded(self):
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!",
"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
Expand Down

0 comments on commit 6a2b8f6

Please sign in to comment.