Skip to content

Commit

Permalink
[16.0][MIG] account_banking_mandate: migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
gfcapalbo authored and hildickethan committed Mar 6, 2023
1 parent d276fd3 commit 9d26ba3
Show file tree
Hide file tree
Showing 13 changed files with 64 additions and 180 deletions.
17 changes: 10 additions & 7 deletions account_banking_mandate/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ Account Banking Mandate
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fbank--payment-lightgray.png?logo=github
:target: https://github.com/OCA/bank-payment/tree/15.0/account_banking_mandate
:target: https://github.com/OCA/bank-payment/tree/16.0/account_banking_mandate
:alt: OCA/bank-payment
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/bank-payment-15-0/bank-payment-15-0-account_banking_mandate
:target: https://translation.odoo-community.org/projects/bank-payment-16-0/bank-payment-16-0-account_banking_mandate
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/173/15.0
:alt: Try me on Runbot
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/webui/builds.html?repo=OCA/bank-payment&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

Expand Down Expand Up @@ -58,7 +58,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/bank-payment/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/bank-payment/issues/new?body=module:%20account_banking_mandate%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/bank-payment/issues/new?body=module:%20account_banking_mandate%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.

Expand All @@ -71,6 +71,7 @@ Authors
* Compassion CH
* Tecnativa
* Akretion
* Therp B.V.

Contributors
~~~~~~~~~~~~
Expand All @@ -85,6 +86,8 @@ Contributors
* Marçal Isern <marsal.isern@qubiq.es>
* Andrea Stirpe <a.stirpe@onestein.nl>
* Manuel Regidor <manuel.regidor@sygel.es>
* Giovanni Francesco Capalbo <giovanni@therp.nl>


Maintainers
~~~~~~~~~~~
Expand All @@ -99,6 +102,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/bank-payment <https://github.com/OCA/bank-payment/tree/15.0/account_banking_mandate>`_ project on GitHub.
This module is part of the `OCA/bank-payment <https://github.com/OCA/bank-payment/tree/16.0/account_banking_mandate>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
4 changes: 2 additions & 2 deletions account_banking_mandate/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@
{
"name": "Account Banking Mandate",
"summary": "Banking mandates",
"version": "15.0.1.0.1",
"version": "16.0.1.0.0",
"development_status": "Production/Stable",
"license": "AGPL-3",
"author": "Compassion CH, "
"Tecnativa, "
"Akretion, "
"Therp B.V., "
"Odoo Community Association (OCA)",
"website": "https://github.com/OCA/bank-payment",
"category": "Banking addons",
Expand All @@ -24,7 +25,6 @@
"views/account_payment_line.xml",
"views/res_partner_bank_view.xml",
"views/res_partner.xml",
"views/bank_payment_line_view.xml",
"data/mandate_reference_sequence.xml",
"security/mandate_security.xml",
"security/ir.model.access.csv",
Expand Down
1 change: 0 additions & 1 deletion account_banking_mandate/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@
from . import res_partner_bank
from . import res_partner
from . import account_payment_line
from . import bank_payment_line
from . import account_move_line
4 changes: 2 additions & 2 deletions account_banking_mandate/models/account_banking_mandate.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ def _get_default_partner_bank_id_domain(self):
tracking=40,
domain=lambda self: self._get_default_partner_bank_id_domain(),
ondelete="restrict",
index=True,
index="btree",
check_company=True,
)
partner_id = fields.Many2one(
comodel_name="res.partner",
related="partner_bank_id.partner_id",
string="Partner",
store=True,
index=True,
index="btree",
)
company_id = fields.Many2one(
comodel_name="res.company",
Expand Down
23 changes: 0 additions & 23 deletions account_banking_mandate/models/bank_payment_line.py

This file was deleted.

1 change: 1 addition & 0 deletions account_banking_mandate/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
* Marçal Isern <marsal.isern@qubiq.es>
* Andrea Stirpe <a.stirpe@onestein.nl>
* Manuel Regidor <manuel.regidor@sygel.es>
* Giovanni Francesco Capalbo <giovanni@therp.nl>
10 changes: 6 additions & 4 deletions account_banking_mandate/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>Account Banking Mandate</title>
<style type="text/css">

Expand Down Expand Up @@ -367,7 +367,7 @@ <h1 class="title">Account Banking Mandate</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.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/bank-payment/tree/15.0/account_banking_mandate"><img alt="OCA/bank-payment" src="https://img.shields.io/badge/github-OCA%2Fbank--payment-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/bank-payment-15-0/bank-payment-15-0-account_banking_mandate"><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/173/15.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="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.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/bank-payment/tree/16.0/account_banking_mandate"><img alt="OCA/bank-payment" src="https://img.shields.io/badge/github-OCA%2Fbank--payment-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/bank-payment-16-0/bank-payment-16-0-account_banking_mandate"><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/webui/builds.html?repo=OCA/bank-payment&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 adds a generic model for banking mandates.
These mandates can be specialized to fit any banking mandates (such as sepa or lsv).</p>
<p>A banking mandate is attached to a bank account and represents an
Expand Down Expand Up @@ -404,7 +404,7 @@ <h1><a class="toc-backref" href="#id3">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/bank-payment/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/bank-payment/issues/new?body=module:%20account_banking_mandate%0Aversion:%2015.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/bank-payment/issues/new?body=module:%20account_banking_mandate%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">
Expand All @@ -415,6 +415,7 @@ <h2><a class="toc-backref" href="#id5">Authors</a></h2>
<li>Compassion CH</li>
<li>Tecnativa</li>
<li>Akretion</li>
<li>Therp B.V.</li>
</ul>
</div>
<div class="section" id="contributors">
Expand All @@ -430,6 +431,7 @@ <h2><a class="toc-backref" href="#id6">Contributors</a></h2>
<li>Marçal Isern &lt;<a class="reference external" href="mailto:marsal.isern&#64;qubiq.es">marsal.isern&#64;qubiq.es</a>&gt;</li>
<li>Andrea Stirpe &lt;<a class="reference external" href="mailto:a.stirpe&#64;onestein.nl">a.stirpe&#64;onestein.nl</a>&gt;</li>
<li>Manuel Regidor &lt;<a class="reference external" href="mailto:manuel.regidor&#64;sygel.es">manuel.regidor&#64;sygel.es</a>&gt;</li>
<li>Giovanni Francesco Capalbo &lt;<a class="reference external" href="mailto:giovanni&#64;therp.nl">giovanni&#64;therp.nl</a>&gt;</li>
</ul>
</div>
<div class="section" id="maintainers">
Expand All @@ -439,7 +441,7 @@ <h2><a class="toc-backref" href="#id7">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/bank-payment/tree/15.0/account_banking_mandate">OCA/bank-payment</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/bank-payment/tree/16.0/account_banking_mandate">OCA/bank-payment</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
12 changes: 2 additions & 10 deletions account_banking_mandate/tests/test_invoice_mandate.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,11 +262,7 @@ def setUp(self):

self.invoice_account = self.env["account.account"].search(
[
(
"user_type_id",
"=",
self.env.ref("account.data_account_type_receivable").id,
),
("account_type", "=", "asset_receivable"),
("company_id", "=", self.company.id),
],
limit=1,
Expand All @@ -275,11 +271,7 @@ def setUp(self):
self.env["account.account"]
.search(
[
(
"user_type_id",
"=",
self.env.ref("account.data_account_type_expenses").id,
),
("account_type", "=", "expense"),
("company_id", "=", self.company.id),
],
limit=1,
Expand Down
126 changes: 33 additions & 93 deletions account_banking_mandate/tests/test_mandate.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,115 +9,64 @@


class TestMandate(TransactionCase):
def test_mandate_01(self):
bank_account = self.env.ref("account_payment_mode.res_partner_12_iban")
mandate = self.env["account.banking.mandate"].create(
def setUp(self):
super(TestMandate, self).setUp()
self.company = self.env.company
self.company_2 = self.env["res.company"].create({"name": "company 2"})
self.company_2.partner_id.company_id = self.company_2.id
self.bank_account = self.env.ref("account_payment_mode.res_partner_12_iban")
self.bank_account.partner_id.company_id = self.company.id
self.mandate = self.env["account.banking.mandate"].create(
{
"partner_bank_id": bank_account.id,
"partner_bank_id": self.bank_account.id,
"signature_date": "2015-01-01",
"company_id": self.company.id,
}
)
self.assertEqual(mandate.state, "draft")
mandate.validate()
self.assertEqual(mandate.state, "valid")
mandate.cancel()
self.assertEqual(mandate.state, "cancel")
mandate.back2draft()
self.assertEqual(mandate.state, "draft")

def test_mandate_01(self):
self.assertEqual(self.mandate.state, "draft")
self.mandate.validate()
self.assertEqual(self.mandate.state, "valid")
self.mandate.cancel()
self.assertEqual(self.mandate.state, "cancel")
self.mandate.back2draft()
self.assertEqual(self.mandate.state, "draft")

def test_mandate_02(self):
bank_account = self.env.ref("account_payment_mode.res_partner_12_iban")
mandate = self.env["account.banking.mandate"].create(
{
"partner_bank_id": bank_account.id,
"signature_date": "2015-01-01",
"company_id": self.company.id,
}
)
with self.assertRaises(UserError):
mandate.back2draft()
self.mandate.back2draft()

def test_mandate_03(self):
bank_account = self.env.ref("account_payment_mode.res_partner_12_iban")
mandate = self.env["account.banking.mandate"].create(
{
"partner_bank_id": bank_account.id,
"signature_date": "2015-01-01",
"company_id": self.company.id,
}
)
mandate.validate()

self.mandate.validate()
with self.assertRaises(UserError):
mandate.validate()
self.mandate.validate()

def test_mandate_04(self):
bank_account = self.env.ref("account_payment_mode.res_partner_12_iban")
mandate = self.env["account.banking.mandate"].create(
{
"partner_bank_id": bank_account.id,
"signature_date": "2015-01-01",
"company_id": self.company.id,
}
)
mandate.validate()
mandate.cancel()
self.mandate.validate()
self.mandate.cancel()
with self.assertRaises(UserError):
mandate.cancel()
self.mandate.cancel()

def test_onchange_methods(self):
bank_account = self.env.ref("account_payment_mode.res_partner_12_iban")
mandate = self.env["account.banking.mandate"].new(
{
"partner_bank_id": bank_account.id,
"signature_date": "2015-01-01",
"company_id": self.company.id,
}
)
bank_account_2 = self.env.ref("account_payment_mode.res_partner_2_iban")
mandate.partner_bank_id = bank_account_2
mandate.mandate_partner_bank_change()
self.assertEqual(mandate.partner_id, bank_account_2.partner_id)
self.mandate.partner_bank_id = bank_account_2
self.mandate.mandate_partner_bank_change()
self.assertEqual(self.mandate.partner_id, bank_account_2.partner_id)

def test_constrains_01(self):
bank_account = self.env.ref("account_payment_mode.res_partner_12_iban")
mandate = self.env["account.banking.mandate"].create(
{
"partner_bank_id": bank_account.id,
"signature_date": "2015-01-01",
"company_id": self.company.id,
}
)
mandate.validate()
self.mandate.validate()
with self.assertRaises(ValidationError):
mandate.signature_date = fields.Date.to_string(
fields.Date.from_string(fields.Date.context_today(mandate))
self.mandate.signature_date = fields.Date.to_string(
fields.Date.from_string(fields.Date.context_today(self.mandate))
+ timedelta(days=1)
)

def test_constrains_02(self):
bank_account = self.env.ref("account_payment_mode.res_partner_12_iban")
mandate = self.env["account.banking.mandate"].create(
{
"partner_bank_id": bank_account.id,
"signature_date": "2015-01-01",
"company_id": self.company.id,
}
)

with self.assertRaises(UserError):
mandate.company_id = self.company_2
self.mandate.company_id = self.company_2

def test_constrains_03(self):
bank_account = self.env.ref("account_payment_mode.res_partner_12_iban")
mandate = self.env["account.banking.mandate"].create(
{
"partner_bank_id": bank_account.id,
"signature_date": "2015-01-01",
"company_id": self.company.id,
}
)
bank_account_2 = self.env["res.partner.bank"].create(
{
"acc_number": "1234",
Expand All @@ -126,7 +75,7 @@ def test_constrains_03(self):
}
)
with self.assertRaises(UserError):
mandate.partner_bank_id = bank_account_2
self.mandate.partner_bank_id = bank_account_2

def test_constrains_04(self):
mandate = self.env["account.banking.mandate"].create(
Expand All @@ -140,7 +89,7 @@ def test_constrains_04(self):
}
)
with self.assertRaises(UserError):
bank_account.mandate_ids += mandate
bank_account.write({"mandate_ids": [(6, 0, mandate.ids)]})

def test_mandate_reference_01(self):
"""
Expand Down Expand Up @@ -222,12 +171,3 @@ def test_mandate_reference_06(self):
}
)
self.assertTrue(mandate.unique_mandate_reference)

def setUp(self):
res = super(TestMandate, self).setUp()
# Company
self.company = self.env.ref("base.main_company")

# Company 2
self.company_2 = self.env["res.company"].create({"name": "Company 2"})
return res
Loading

0 comments on commit 9d26ba3

Please sign in to comment.