[MIG][12.0] adapt tests to v12

This commit is contained in:
Iryna Vyshnevska
2019-07-18 18:10:43 +03:00
committed by nguyenhk
parent ebe13366c1
commit 2a7ac72af8
4 changed files with 208 additions and 29 deletions

View File

@@ -0,0 +1,77 @@
===================================
Reconcile restrict partner mismatch
===================================
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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/12.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-12-0/account-reconcile-12-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/12.0
:alt: Try me on Runbot
|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.
**Table of contents**
.. contents::
:local:
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:%2012.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
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/12.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,104 @@
# 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 12.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.fields,field_description:account_reconcile_restrict_partner_mismatch.field_account_reconcile_partner_mismatch_report__account_type_id
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_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_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_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:26
#, python-format
msgid "The partner has to be the same on all lines for receivable and payable accounts!"
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 ""

View File

@@ -3,8 +3,8 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.14: http://docutils.sourceforge.net/" /> <meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
<title>Account Set Reconcilable</title> <title>Reconcile restrict partner mismatch</title>
<style type="text/css"> <style type="text/css">
/* /*
@@ -360,23 +360,32 @@ ul.auto-toc {
</style> </style>
</head> </head>
<body> <body>
<div class="document" id="account-set-reconcilable"> <div class="document" id="reconcile-restrict-partner-mismatch">
<h1 class="title">Account Set Reconcilable</h1> <h1 class="title">Reconcile restrict partner mismatch</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! <!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! 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/10.0/account_set_reconcilable"><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-10-0/account-reconcile-10-0-account_set_reconcilable"><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/10.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/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>Allows to set as reconcilable a non reconcilable account that already have journal items.</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><strong>Table of contents</strong></p> <p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents"> <div class="contents local topic" id="contents">
<ul class="simple"> <ul class="simple">
<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="#contributors" id="id4">Contributors</a></li> <li><a class="reference internal" href="#maintainers" id="id4">Maintainers</a></li>
<li><a class="reference internal" href="#maintainers" id="id5">Maintainers</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>
@@ -386,7 +395,7 @@ ul.auto-toc {
<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_set_reconcilable%0Aversion:%2010.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:%2012.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">
@@ -394,23 +403,17 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<div class="section" id="authors"> <div class="section" id="authors">
<h2><a class="toc-backref" href="#id3">Authors</a></h2> <h2><a class="toc-backref" href="#id3">Authors</a></h2>
<ul class="simple"> <ul class="simple">
<li>Eficent</li> <li>Camptocamp</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#id4">Contributors</a></h2>
<ul class="simple">
<li>Miquel Raïch &lt;<a class="reference external" href="mailto:miquel.raich&#64;eficent.com">miquel.raich&#64;eficent.com</a>&gt;</li>
</ul> </ul>
</div> </div>
<div class="section" id="maintainers"> <div class="section" id="maintainers">
<h2><a class="toc-backref" href="#id5">Maintainers</a></h2> <h2><a class="toc-backref" href="#id4">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/10.0/account_set_reconcilable">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/12.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>

View File

@@ -31,11 +31,6 @@ class TestReconciliation(AccountingTestCase):
self.bank_journal = self.env['account.journal']. \ self.bank_journal = self.env['account.journal']. \
create({'name': 'Bank', 'type': 'bank', 'code': 'BNK67'}) create({'name': 'Bank', 'type': 'bank', 'code': 'BNK67'})
self.aml = self.init_moves() self.aml = self.init_moves()
self.wizard = self.env['account.move.line.reconcile.writeoff']. \
with_context(active_ids=[x.id for x in self.aml]).create({
'journal_id': self.bank_journal.id,
'writeoff_acc_id': self.account_rsa.id
})
def create_move(self, name, amount): def create_move(self, name, amount):
debit_line_vals = { debit_line_vals = {
@@ -73,22 +68,22 @@ class TestReconciliation(AccountingTestCase):
return aml_recs return aml_recs
def test_reconcile_no_partner(self): def test_reconcile_no_partner(self):
self.wizard.trans_rec_reconcile() self.aml.reconcile()
self.assertTrue(all(self.aml.mapped('reconciled'))) self.assertTrue(all(self.aml.mapped('reconciled')))
def test_reconcile_partner_mismatch(self): def test_reconcile_partner_mismatch(self):
self.aml[0].partner_id = self.partner.id self.aml[0].partner_id = self.partner.id
with self.assertRaises(UserError): with self.assertRaises(UserError):
self.wizard.trans_rec_reconcile() self.aml.reconcile()
# all lines with same partner allowed # all lines with same partner allowed
self.aml.write({'partner_id': self.partner.id}) self.aml.write({'partner_id': self.partner.id})
self.wizard.trans_rec_reconcile() self.aml.reconcile()
self.assertTrue(all(self.aml.mapped('reconciled'))) self.assertTrue(all(self.aml.mapped('reconciled')))
def test_reconcile_accounts_excluded(self): def test_reconcile_accounts_excluded(self):
self.aml[0].partner_id = self.partner.id self.aml[0].partner_id = self.partner.id
with self.assertRaises(UserError): with self.assertRaises(UserError):
self.wizard.trans_rec_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'].search([
('user_type_id.type', '=', 'other') ('user_type_id.type', '=', 'other')
@@ -96,9 +91,9 @@ class TestReconciliation(AccountingTestCase):
account.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.wizard.trans_rec_reconcile() self.aml.reconcile()
# reconciliation for different partners allowed # reconciliation for different partners allowed
# for not forbidden types # for not forbidden types
self.aml.write({'account_id': account.id}) self.aml.write({'account_id': account.id})
self.wizard.trans_rec_reconcile() self.aml.reconcile()
self.assertTrue(all(self.aml.mapped('reconciled'))) self.assertTrue(all(self.aml.mapped('reconciled')))