[IMP] account_reconcile_restrict_partner_mismatch: Avoid restriction on some journals / Enable on company level
In some cases, accounting users should be allowed to mix partners. This will be configured on account journal level. In order to not break standard behaviors, the restriction feature should be enabled by a configuration parameter on company level. A new configuration parameter has been added.pull/596/head
parent
d79fd0dd12
commit
25e64edab4
|
@ -7,7 +7,7 @@ Reconcile restrict partner mismatch
|
|||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! source digest: sha256:e643e776a13ac74578f05aa23fc0328120234f43ff74182e837e0d18e2f357ae
|
||||
!! source digest: sha256:893e295e519a93dd096174319fa89d25509ab7df53a313bf5cc93c2b98a6be42
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
|
||||
|
@ -39,11 +39,22 @@ 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
|
||||
===========
|
||||
|
||||
|
|
|
@ -11,6 +11,11 @@
|
|||
"website": "https://github.com/OCA/account-reconcile",
|
||||
"category": "Finance",
|
||||
"license": "AGPL-3",
|
||||
"data": ["report/account_move_lines_report.xml", "security/ir.model.access.csv"],
|
||||
"data": [
|
||||
"security/ir.model.access.csv",
|
||||
"report/account_move_lines_report.xml",
|
||||
"views/account_journal.xml",
|
||||
"views/res_config_settings.xml",
|
||||
],
|
||||
"installable": True,
|
||||
}
|
||||
|
|
|
@ -1 +1,4 @@
|
|||
from . import account_move_line
|
||||
from . import account_journal
|
||||
from . import res_company
|
||||
from . import res_config_settings
|
||||
|
|
|
@ -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."
|
||||
)
|
|
@ -3,25 +3,31 @@
|
|||
|
||||
from odoo import _, models
|
||||
from odoo.exceptions import UserError
|
||||
from odoo.tools import config
|
||||
|
||||
|
||||
class AccountMoveLine(models.Model):
|
||||
_inherit = "account.move.line"
|
||||
|
||||
def reconcile(self):
|
||||
if config["test_enable"] and not self.env.context.get("test_partner_mismatch"):
|
||||
return super().reconcile()
|
||||
@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 not self:
|
||||
return True
|
||||
partners = set()
|
||||
for line in self:
|
||||
if line.account_id.account_type in (
|
||||
"asset_receivable",
|
||||
"liability_payable",
|
||||
):
|
||||
if line._check_partner_mismatch_on_reconcile:
|
||||
partners.add(line.partner_id.id)
|
||||
if len(partners) > 1:
|
||||
raise UserError(
|
||||
|
|
|
@ -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."
|
||||
)
|
|
@ -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,
|
||||
)
|
|
@ -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.
|
|
@ -8,3 +8,5 @@ This rule applies only for journal items using receivable and payable account ty
|
|||
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.
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!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: http://docutils.sourceforge.net/" />
|
||||
<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 7952 2016-07-26 18:15:59Z milde $
|
||||
: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 http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
|
||||
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
|
||||
customize this style sheet.
|
||||
*/
|
||||
|
||||
|
@ -275,7 +275,7 @@ pre.literal-block, pre.doctest-block, pre.math, pre.code {
|
|||
margin-left: 2em ;
|
||||
margin-right: 2em }
|
||||
|
||||
pre.code .ln { color: grey; } /* line numbers */
|
||||
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 }
|
||||
|
@ -301,7 +301,7 @@ span.option {
|
|||
span.pre {
|
||||
white-space: pre }
|
||||
|
||||
span.problematic {
|
||||
span.problematic, pre.problematic {
|
||||
color: red }
|
||||
|
||||
span.section-subtitle {
|
||||
|
@ -367,9 +367,9 @@ ul.auto-toc {
|
|||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! source digest: sha256:e643e776a13ac74578f05aa23fc0328120234f43ff74182e837e0d18e2f357ae
|
||||
!! source digest: sha256:893e295e519a93dd096174319fa89d25509ab7df53a313bf5cc93c2b98a6be42
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||
<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&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/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&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">
|
||||
|
@ -381,21 +381,33 @@ ul.auto-toc {
|
|||
<p>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.</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="#bug-tracker" id="id1">Bug Tracker</a></li>
|
||||
<li><a class="reference internal" href="#credits" id="id2">Credits</a><ul>
|
||||
<li><a class="reference internal" href="#authors" id="id3">Authors</a></li>
|
||||
<li><a class="reference internal" href="#contributors" id="id4">Contributors</a></li>
|
||||
<li><a class="reference internal" href="#other-credits" id="id5">Other credits</a></li>
|
||||
<li><a class="reference internal" href="#maintainers" id="id6">Maintainers</a></li>
|
||||
<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 > Configuration > Settings > 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 > Configuration > Accounting > Journals</li>
|
||||
<li>In Advanced Settings > 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="#id1">Bug Tracker</a></h1>
|
||||
<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
|
||||
|
@ -403,15 +415,15 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
|
|||
<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="#id2">Credits</a></h1>
|
||||
<h1><a class="toc-backref" href="#toc-entry-3">Credits</a></h1>
|
||||
<div class="section" id="authors">
|
||||
<h2><a class="toc-backref" href="#id3">Authors</a></h2>
|
||||
<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="#id4">Contributors</a></h2>
|
||||
<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>
|
||||
|
@ -422,13 +434,15 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
|
|||
</ul>
|
||||
</div>
|
||||
<div class="section" id="other-credits">
|
||||
<h2><a class="toc-backref" href="#id5">Other credits</a></h2>
|
||||
<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="#id6">Maintainers</a></h2>
|
||||
<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>
|
||||
<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>
|
||||
|
|
|
@ -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>
|
|
@ -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>
|
Loading…
Reference in New Issue