mirror of
https://github.com/OCA/account-reconcile.git
synced 2025-01-20 12:27:39 +02:00
[MIG] account_reconcile_restrict_partner_mismatch: Migration to 13.0
This commit is contained in:
@@ -14,13 +14,13 @@ Reconcile restrict partner mismatch
|
|||||||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
||||||
:alt: License: AGPL-3
|
:alt: License: AGPL-3
|
||||||
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--reconcile-lightgray.png?logo=github
|
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--reconcile-lightgray.png?logo=github
|
||||||
:target: https://github.com/OCA/account-reconcile/tree/12.0/account_reconcile_restrict_partner_mismatch
|
:target: https://github.com/OCA/account-reconcile/tree/13.0/account_reconcile_restrict_partner_mismatch
|
||||||
:alt: OCA/account-reconcile
|
:alt: OCA/account-reconcile
|
||||||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
||||||
:target: https://translation.odoo-community.org/projects/account-reconcile-12-0/account-reconcile-12-0-account_reconcile_restrict_partner_mismatch
|
:target: https://translation.odoo-community.org/projects/account-reconcile-13-0/account-reconcile-13-0-account_reconcile_restrict_partner_mismatch
|
||||||
:alt: Translate me on Weblate
|
:alt: Translate me on Weblate
|
||||||
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
|
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
|
||||||
:target: https://runbot.odoo-community.org/runbot/98/12.0
|
:target: https://runbot.odoo-community.org/runbot/98/13.0
|
||||||
:alt: Try me on Runbot
|
:alt: Try me on Runbot
|
||||||
|
|
||||||
|badge1| |badge2| |badge3| |badge4| |badge5|
|
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||||
@@ -47,7 +47,7 @@ Bug Tracker
|
|||||||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-reconcile/issues>`_.
|
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.
|
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
|
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:%2012.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:%2013.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.
|
Do not contact contributors directly about support or help with technical issues.
|
||||||
|
|
||||||
@@ -59,6 +59,13 @@ Authors
|
|||||||
|
|
||||||
* Camptocamp
|
* Camptocamp
|
||||||
|
|
||||||
|
Contributors
|
||||||
|
~~~~~~~~~~~~
|
||||||
|
|
||||||
|
* `Tecnativa <https://www.tecnativa.com>`_:
|
||||||
|
|
||||||
|
* Ernesto Tejeda
|
||||||
|
|
||||||
Maintainers
|
Maintainers
|
||||||
~~~~~~~~~~~
|
~~~~~~~~~~~
|
||||||
|
|
||||||
@@ -72,6 +79,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
|
|||||||
mission is to support the collaborative development of Odoo features and
|
mission is to support the collaborative development of Odoo features and
|
||||||
promote its widespread use.
|
promote its widespread use.
|
||||||
|
|
||||||
This module is part of the `OCA/account-reconcile <https://github.com/OCA/account-reconcile/tree/12.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/13.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.
|
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||||
|
|||||||
0
account_reconcile_restrict_partner_mismatch/__init__.py
Executable file → Normal file
0
account_reconcile_restrict_partner_mismatch/__init__.py
Executable file → Normal file
@@ -5,7 +5,7 @@
|
|||||||
"name": "Reconcile restrict partner mismatch",
|
"name": "Reconcile restrict partner mismatch",
|
||||||
"summary": "Restrict reconciliation on receivable "
|
"summary": "Restrict reconciliation on receivable "
|
||||||
"and payable accounts to the same partner",
|
"and payable accounts to the same partner",
|
||||||
"version": "12.0.1.0.0",
|
"version": "13.0.1.0.0",
|
||||||
"depends": ["account"],
|
"depends": ["account"],
|
||||||
"author": "Camptocamp, Odoo Community Association (OCA)",
|
"author": "Camptocamp, Odoo Community Association (OCA)",
|
||||||
"website": "http://www.github.com/OCA/account-reconcile",
|
"website": "http://www.github.com/OCA/account-reconcile",
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
# Translation of Odoo Server.
|
# Translation of Odoo Server.
|
||||||
# This file contains the translation of the following modules:
|
# This file contains the translation of the following modules:
|
||||||
# * account_reconcile_restrict_partner_mismatch
|
# * account_reconcile_restrict_partner_mismatch
|
||||||
#
|
#
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: Odoo Server 12.0\n"
|
"Project-Id-Version: Odoo Server 13.0\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"Last-Translator: <>\n"
|
"Last-Translator: \n"
|
||||||
"Language-Team: \n"
|
"Language-Team: \n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
@@ -97,8 +97,9 @@ msgid "Reconciled items with partner mismatch"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#. module: account_reconcile_restrict_partner_mismatch
|
#. module: account_reconcile_restrict_partner_mismatch
|
||||||
#: code:addons/account_reconcile_restrict_partner_mismatch/models/account_move_line.py:26
|
#: code:addons/account_reconcile_restrict_partner_mismatch/models/account_move_line.py:0
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "The partner has to be the same on all lines for receivable and payable accounts!"
|
msgid ""
|
||||||
|
"The partner has to be the same on all lines for receivable and payable "
|
||||||
|
"accounts!"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
|||||||
0
account_reconcile_restrict_partner_mismatch/models/__init__.py
Executable file → Normal file
0
account_reconcile_restrict_partner_mismatch/models/__init__.py
Executable file → Normal file
@@ -1,7 +1,7 @@
|
|||||||
# Copyright 2019 Camptocamp SA
|
# Copyright 2019 Camptocamp SA
|
||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||||
|
|
||||||
from odoo import _, api, models
|
from odoo import _, models
|
||||||
from odoo.exceptions import UserError
|
from odoo.exceptions import UserError
|
||||||
from odoo.tools import config
|
from odoo.tools import config
|
||||||
|
|
||||||
@@ -9,7 +9,6 @@ from odoo.tools import config
|
|||||||
class AccountMoveLine(models.Model):
|
class AccountMoveLine(models.Model):
|
||||||
_inherit = "account.move.line"
|
_inherit = "account.move.line"
|
||||||
|
|
||||||
@api.multi
|
|
||||||
def reconcile(self, writeoff_acc_id=False, writeoff_journal_id=False):
|
def reconcile(self, writeoff_acc_id=False, writeoff_journal_id=False):
|
||||||
if config["test_enable"] and not self.env.context.get("test_partner_mismatch"):
|
if config["test_enable"] and not self.env.context.get("test_partner_mismatch"):
|
||||||
return super().reconcile(writeoff_acc_id, writeoff_journal_id)
|
return super().reconcile(writeoff_acc_id, writeoff_journal_id)
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
* `Tecnativa <https://www.tecnativa.com>`_:
|
||||||
|
|
||||||
|
* Ernesto Tejeda
|
||||||
@@ -1,61 +1,74 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<record id="view_account_move_reconciled_report_tree" model="ir.ui.view">
|
<record id="view_account_move_reconciled_report_tree" model="ir.ui.view">
|
||||||
<field name="name">Reconciled items with partner mismatch</field>
|
<field name="name">Reconciled items with partner mismatch</field>
|
||||||
<field name="model">account.reconcile.partner.mismatch.report</field>
|
<field name="model">account.reconcile.partner.mismatch.report</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<tree string="Reconciled items with partner mismatch" create="false" delete="false" edit="false">
|
<tree
|
||||||
|
string="Reconciled items with partner mismatch"
|
||||||
|
create="false"
|
||||||
|
delete="false"
|
||||||
|
edit="false"
|
||||||
|
>
|
||||||
<!-- links are not clickable in tree view
|
<!-- links are not clickable in tree view
|
||||||
only after open form view -->
|
only after open form view -->
|
||||||
<field name="partial_reconcile_id" />
|
<field name="partial_reconcile_id" />
|
||||||
<field name="full_reconcile_id" />
|
<field name="full_reconcile_id" />
|
||||||
<field name="debit_move_id" />
|
<field name="debit_move_id" />
|
||||||
<field name="debit_amount" />
|
<field name="debit_amount" />
|
||||||
<field name="debit_partner_id" />
|
<field name="debit_partner_id" />
|
||||||
<field name="credit_move_id" />
|
<field name="credit_move_id" />
|
||||||
<field name="credit_amount" />
|
<field name="credit_amount" />
|
||||||
<field name="credit_partner_id" />
|
<field name="credit_partner_id" />
|
||||||
<field name="account_type_id" />
|
<field name="account_type_id" />
|
||||||
<field name="account_id" />
|
<field name="account_id" />
|
||||||
</tree>
|
</tree>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
<record id="account_reconcile_partner_mismatch_report_view_form" model="ir.ui.view">
|
||||||
<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="name">account.reconcile.partner.mismatch.report.form</field>
|
<field name="model">account.reconcile.partner.mismatch.report</field>
|
||||||
<field name="model">account.reconcile.partner.mismatch.report</field>
|
<field name="arch" type="xml">
|
||||||
<field name="arch" type="xml">
|
<form
|
||||||
<form string="Reconciled items with partner mismatch" create="false" delete="false" edit="false">
|
string="Reconciled items with partner mismatch"
|
||||||
<sheet>
|
create="false"
|
||||||
|
delete="false"
|
||||||
|
edit="false"
|
||||||
|
>
|
||||||
|
<sheet>
|
||||||
|
<group>
|
||||||
<group>
|
<group>
|
||||||
<group>
|
<field name="partial_reconcile_id" />
|
||||||
<field name="partial_reconcile_id" />
|
<field name="full_reconcile_id" />
|
||||||
<field name="full_reconcile_id" />
|
<field name="debit_amount" />
|
||||||
<field name="debit_amount" />
|
<field name="credit_amount" />
|
||||||
<field name="credit_amount" />
|
<field name="debit_partner_id" />
|
||||||
<field name="debit_partner_id" />
|
<field name="credit_partner_id" />
|
||||||
<field name="credit_partner_id" />
|
|
||||||
</group>
|
|
||||||
<group>
|
|
||||||
<field name="account_id" />
|
|
||||||
<field name="account_type_id" />
|
|
||||||
<field name="debit_move_id" />
|
|
||||||
<field name="credit_move_id" />
|
|
||||||
</group>
|
|
||||||
</group>
|
</group>
|
||||||
</sheet>
|
<group>
|
||||||
</form>
|
<field name="account_id" />
|
||||||
</field>
|
<field name="account_type_id" />
|
||||||
</record>
|
<field name="debit_move_id" />
|
||||||
|
<field name="credit_move_id" />
|
||||||
<record id="action_account_reconcile_partner_mismatch_report" model="ir.actions.act_window">
|
</group>
|
||||||
<field name="name">Reconciled items with partner mismatch</field>
|
</group>
|
||||||
<field name="res_model">account.reconcile.partner.mismatch.report</field>
|
</sheet>
|
||||||
<field name="view_mode">tree,form</field>
|
</form>
|
||||||
</record>
|
</field>
|
||||||
|
</record>
|
||||||
<menuitem id="menu_account_reconcile_partner_mismatch_report"
|
<record
|
||||||
parent="account.menu_finance_entries" sequence="80"
|
id="action_account_reconcile_partner_mismatch_report"
|
||||||
action="action_account_reconcile_partner_mismatch_report"
|
model="ir.actions.act_window"
|
||||||
name="Reconciled items with partner mismatch"/>
|
>
|
||||||
|
<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>
|
</odoo>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||||
|
|
||||||
|
|
||||||
from odoo import api, fields, models, tools
|
from odoo import fields, models, tools
|
||||||
|
|
||||||
|
|
||||||
class AccountReconcilePartnerMismatchReport(models.Model):
|
class AccountReconcilePartnerMismatchReport(models.Model):
|
||||||
@@ -23,7 +23,6 @@ class AccountReconcilePartnerMismatchReport(models.Model):
|
|||||||
credit_amount = fields.Float("Credit amount")
|
credit_amount = fields.Float("Credit amount")
|
||||||
credit_partner_id = fields.Many2one("res.partner", string="Credit partner")
|
credit_partner_id = fields.Many2one("res.partner", string="Credit partner")
|
||||||
|
|
||||||
@api.model_cr
|
|
||||||
def init(self):
|
def init(self):
|
||||||
"""Select lines which violate defined rules"""
|
"""Select lines which violate defined rules"""
|
||||||
tools.drop_view_if_exists(self.env.cr, self._table)
|
tools.drop_view_if_exists(self.env.cr, self._table)
|
||||||
@@ -45,8 +44,10 @@ class AccountReconcilePartnerMismatchReport(models.Model):
|
|||||||
ON daml.id = pr.debit_move_id
|
ON daml.id = pr.debit_move_id
|
||||||
LEFT JOIN account_move_line caml
|
LEFT JOIN account_move_line caml
|
||||||
ON caml.id = pr.credit_move_id
|
ON caml.id = pr.credit_move_id
|
||||||
|
LEFT JOIN account_account aa
|
||||||
|
ON daml.account_id = aa.id
|
||||||
LEFT JOIN account_account_type aat
|
LEFT JOIN account_account_type aat
|
||||||
ON daml.user_type_id = aat.id
|
ON aa.user_type_id = aat.id
|
||||||
WHERE aat.type in ('receivable', 'payable')
|
WHERE aat.type in ('receivable', 'payable')
|
||||||
AND (daml.partner_id <> caml.partner_id
|
AND (daml.partner_id <> caml.partner_id
|
||||||
OR (daml.partner_id IS NULL
|
OR (daml.partner_id IS NULL
|
||||||
|
|||||||
@@ -367,7 +367,7 @@ ul.auto-toc {
|
|||||||
!! This file is generated by oca-gen-addon-readme !!
|
!! This file is generated by oca-gen-addon-readme !!
|
||||||
!! changes will be overwritten. !!
|
!! changes will be overwritten. !!
|
||||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||||
<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/12.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-12-0/account-reconcile-12-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/12.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/13.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-13-0/account-reconcile-13-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/13.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
|
||||||
<p>This module restricts reconciliation between journal items when:</p>
|
<p>This module restricts reconciliation between journal items when:</p>
|
||||||
<blockquote>
|
<blockquote>
|
||||||
<ul class="simple">
|
<ul class="simple">
|
||||||
@@ -385,7 +385,8 @@ Reconciled items with partner mismatch.</p>
|
|||||||
<li><a class="reference internal" href="#bug-tracker" id="id1">Bug Tracker</a></li>
|
<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="#credits" id="id2">Credits</a><ul>
|
||||||
<li><a class="reference internal" href="#authors" id="id3">Authors</a></li>
|
<li><a class="reference internal" href="#authors" id="id3">Authors</a></li>
|
||||||
<li><a class="reference internal" href="#maintainers" id="id4">Maintainers</a></li>
|
<li><a class="reference internal" href="#contributors" id="id4">Contributors</a></li>
|
||||||
|
<li><a class="reference internal" href="#maintainers" id="id5">Maintainers</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
@@ -395,7 +396,7 @@ Reconciled items with partner mismatch.</p>
|
|||||||
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/account-reconcile/issues">GitHub Issues</a>.
|
<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.
|
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
|
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:%2012.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:%2013.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>
|
<p>Do not contact contributors directly about support or help with technical issues.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="credits">
|
<div class="section" id="credits">
|
||||||
@@ -406,14 +407,23 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
|
|||||||
<li>Camptocamp</li>
|
<li>Camptocamp</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="section" id="contributors">
|
||||||
|
<h2><a class="toc-backref" href="#id4">Contributors</a></h2>
|
||||||
|
<ul class="simple">
|
||||||
|
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
|
||||||
|
<li>Ernesto Tejeda</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
<div class="section" id="maintainers">
|
<div class="section" id="maintainers">
|
||||||
<h2><a class="toc-backref" href="#id4">Maintainers</a></h2>
|
<h2><a class="toc-backref" href="#id5">Maintainers</a></h2>
|
||||||
<p>This module is maintained by the OCA.</p>
|
<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
|
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
|
||||||
mission is to support the collaborative development of Odoo features and
|
mission is to support the collaborative development of Odoo features and
|
||||||
promote its widespread use.</p>
|
promote its widespread use.</p>
|
||||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/account-reconcile/tree/12.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/13.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>
|
<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>
|
</div>
|
||||||
|
|||||||
@@ -2,67 +2,66 @@
|
|||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||||
|
|
||||||
from odoo.exceptions import UserError
|
from odoo.exceptions import UserError
|
||||||
|
from odoo.tests.common import SavepointCase
|
||||||
from odoo.addons.account.tests.account_test_classes import AccountingTestCase
|
|
||||||
|
|
||||||
|
|
||||||
class TestReconciliation(AccountingTestCase):
|
class TestReconciliation(SavepointCase):
|
||||||
def setUp(self):
|
@classmethod
|
||||||
super().setUp()
|
def setUpClass(cls):
|
||||||
self.env = self.env(
|
super().setUpClass()
|
||||||
|
cls.env = cls.env(
|
||||||
context=dict(
|
context=dict(
|
||||||
self.env.context, tracking_disable=True, test_partner_mismatch=True
|
cls.env.context, tracking_disable=True, test_partner_mismatch=True
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
cls.partner = cls.env.ref("base.res_partner_2")
|
||||||
self.partner = self.env.ref("base.res_partner_2")
|
cls.partner_id = cls.partner.id
|
||||||
self.partner_id = self.partner.id
|
cls.account_rcv = cls.env["account.account"].create(
|
||||||
rec_type = self.env["account.account"].search(
|
{
|
||||||
[
|
"code": "RA1000",
|
||||||
(
|
"name": "Test Receivable Account",
|
||||||
"user_type_id",
|
"user_type_id": cls.env.ref("account.data_account_type_receivable").id,
|
||||||
"=",
|
"reconcile": True,
|
||||||
self.env.ref("account.data_account_type_receivable").id,
|
}
|
||||||
)
|
|
||||||
],
|
|
||||||
limit=1,
|
|
||||||
)
|
)
|
||||||
pay_type = self.env["account.account"].search(
|
cls.account_rsa = cls.env["account.account"].create(
|
||||||
[
|
{
|
||||||
(
|
"code": "PA1000",
|
||||||
"user_type_id",
|
"name": "Test Payable Account",
|
||||||
"=",
|
"user_type_id": cls.env.ref("account.data_account_type_payable").id,
|
||||||
self.env.ref("account.data_account_type_payable").id,
|
"reconcile": True,
|
||||||
)
|
}
|
||||||
],
|
|
||||||
limit=1,
|
|
||||||
)
|
)
|
||||||
self.account_rcv = self.partner.property_account_receivable_id or rec_type
|
cls.bank_journal = cls.env["account.journal"].create(
|
||||||
self.account_rsa = self.partner.property_account_payable_id or pay_type
|
|
||||||
|
|
||||||
self.bank_journal = self.env["account.journal"].create(
|
|
||||||
{"name": "Bank", "type": "bank", "code": "BNK67"}
|
{"name": "Bank", "type": "bank", "code": "BNK67"}
|
||||||
)
|
)
|
||||||
self.aml = self.init_moves()
|
cls.aml = cls.init_moves()
|
||||||
|
|
||||||
def create_move(self, name, amount):
|
@classmethod
|
||||||
|
def create_move(cls, name, amount):
|
||||||
debit_line_vals = {
|
debit_line_vals = {
|
||||||
"name": name,
|
"name": name,
|
||||||
"debit": amount > 0 and amount or 0.0,
|
"debit": amount > 0 and amount or 0.0,
|
||||||
"credit": amount < 0 and -amount or 0.0,
|
"credit": amount < 0 and -amount or 0.0,
|
||||||
"account_id": self.account_rcv.id,
|
"account_id": cls.account_rcv.id,
|
||||||
}
|
}
|
||||||
credit_line_vals = debit_line_vals.copy()
|
credit_line_vals = debit_line_vals.copy()
|
||||||
credit_line_vals["debit"] = debit_line_vals["credit"]
|
credit_line_vals["debit"] = debit_line_vals["credit"]
|
||||||
credit_line_vals["credit"] = debit_line_vals["debit"]
|
credit_line_vals["credit"] = debit_line_vals["debit"]
|
||||||
credit_line_vals["account_id"] = self.account_rsa.id
|
credit_line_vals["account_id"] = cls.account_rsa.id
|
||||||
vals = {
|
vals = {
|
||||||
"journal_id": self.bank_journal.id,
|
"journal_id": cls.bank_journal.id,
|
||||||
"line_ids": [(0, 0, debit_line_vals), (0, 0, credit_line_vals)],
|
"line_ids": [(0, 0, debit_line_vals), (0, 0, credit_line_vals)],
|
||||||
}
|
}
|
||||||
return self.env["account.move"].create(vals).id
|
return (
|
||||||
|
cls.env["account.move"]
|
||||||
|
.with_context(default_journal_id=cls.bank_journal.id)
|
||||||
|
.create(vals)
|
||||||
|
.id
|
||||||
|
)
|
||||||
|
|
||||||
def init_moves(self):
|
@classmethod
|
||||||
|
def init_moves(cls):
|
||||||
move_list_vals = [
|
move_list_vals = [
|
||||||
("1", -1.83),
|
("1", -1.83),
|
||||||
("2", 728.35),
|
("2", 728.35),
|
||||||
@@ -73,9 +72,9 @@ class TestReconciliation(AccountingTestCase):
|
|||||||
]
|
]
|
||||||
move_ids = []
|
move_ids = []
|
||||||
for name, amount in move_list_vals:
|
for name, amount in move_list_vals:
|
||||||
move_ids.append(self.create_move(name, amount))
|
move_ids.append(cls.create_move(name, amount))
|
||||||
aml_recs = self.env["account.move.line"].search(
|
aml_recs = cls.env["account.move.line"].search(
|
||||||
[("move_id", "in", move_ids), ("account_id", "=", self.account_rcv.id)]
|
[("move_id", "in", move_ids), ("account_id", "=", cls.account_rcv.id)]
|
||||||
)
|
)
|
||||||
return aml_recs
|
return aml_recs
|
||||||
|
|
||||||
@@ -97,10 +96,16 @@ class TestReconciliation(AccountingTestCase):
|
|||||||
with self.assertRaises(UserError):
|
with self.assertRaises(UserError):
|
||||||
self.aml.reconcile()
|
self.aml.reconcile()
|
||||||
# reconciliation forbiden only for certain types of accounts
|
# reconciliation forbiden only for certain types of accounts
|
||||||
account = self.env["account.account"].search(
|
account = self.env["account.account"].create(
|
||||||
[("user_type_id.type", "=", "other")], limit=1
|
{
|
||||||
|
"code": "CAA1000",
|
||||||
|
"name": "Test Current Assets Account",
|
||||||
|
"user_type_id": self.env.ref(
|
||||||
|
"account.data_account_type_current_assets"
|
||||||
|
).id,
|
||||||
|
"reconcile": True,
|
||||||
|
}
|
||||||
)
|
)
|
||||||
account.reconcile = True
|
|
||||||
self.aml[0].account_id = account.id
|
self.aml[0].account_id = account.id
|
||||||
with self.assertRaises(UserError):
|
with self.assertRaises(UserError):
|
||||||
self.aml.reconcile()
|
self.aml.reconcile()
|
||||||
|
|||||||
Reference in New Issue
Block a user