Skip to content

Commit 9d26ba3

Browse files
gfcapalbohildickethan
authored andcommitted
[16.0][MIG] account_banking_mandate: migration to 16.0
1 parent d276fd3 commit 9d26ba3

13 files changed

+64
-180
lines changed

account_banking_mandate/README.rst

+10-7
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ Account Banking Mandate
1414
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
1515
:alt: License: AGPL-3
1616
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fbank--payment-lightgray.png?logo=github
17-
:target: https://github.com/OCA/bank-payment/tree/15.0/account_banking_mandate
17+
:target: https://github.com/OCA/bank-payment/tree/16.0/account_banking_mandate
1818
:alt: OCA/bank-payment
1919
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
20-
:target: https://translation.odoo-community.org/projects/bank-payment-15-0/bank-payment-15-0-account_banking_mandate
20+
:target: https://translation.odoo-community.org/projects/bank-payment-16-0/bank-payment-16-0-account_banking_mandate
2121
:alt: Translate me on Weblate
22-
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
23-
:target: https://runbot.odoo-community.org/runbot/173/15.0
24-
:alt: Try me on Runbot
22+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
23+
:target: https://runboat.odoo-community.org/webui/builds.html?repo=OCA/bank-payment&target_branch=16.0
24+
:alt: Try me on Runboat
2525

2626
|badge1| |badge2| |badge3| |badge4| |badge5|
2727

@@ -58,7 +58,7 @@ Bug Tracker
5858
Bugs are tracked on `GitHub Issues <https://github.com/OCA/bank-payment/issues>`_.
5959
In case of trouble, please check there if your issue has already been reported.
6060
If you spotted it first, help us smashing it by providing a detailed and welcomed
61-
`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**>`_.
61+
`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**>`_.
6262

6363
Do not contact contributors directly about support or help with technical issues.
6464

@@ -71,6 +71,7 @@ Authors
7171
* Compassion CH
7272
* Tecnativa
7373
* Akretion
74+
* Therp B.V.
7475

7576
Contributors
7677
~~~~~~~~~~~~
@@ -85,6 +86,8 @@ Contributors
8586
* Marçal Isern <marsal.isern@qubiq.es>
8687
* Andrea Stirpe <a.stirpe@onestein.nl>
8788
* Manuel Regidor <manuel.regidor@sygel.es>
89+
* Giovanni Francesco Capalbo <giovanni@therp.nl>
90+
8891

8992
Maintainers
9093
~~~~~~~~~~~
@@ -99,6 +102,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
99102
mission is to support the collaborative development of Odoo features and
100103
promote its widespread use.
101104

102-
This module is part of the `OCA/bank-payment <https://github.com/OCA/bank-payment/tree/15.0/account_banking_mandate>`_ project on GitHub.
105+
This module is part of the `OCA/bank-payment <https://github.com/OCA/bank-payment/tree/16.0/account_banking_mandate>`_ project on GitHub.
103106

104107
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

account_banking_mandate/__manifest__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@
77
{
88
"name": "Account Banking Mandate",
99
"summary": "Banking mandates",
10-
"version": "15.0.1.0.1",
10+
"version": "16.0.1.0.0",
1111
"development_status": "Production/Stable",
1212
"license": "AGPL-3",
1313
"author": "Compassion CH, "
1414
"Tecnativa, "
1515
"Akretion, "
16+
"Therp B.V., "
1617
"Odoo Community Association (OCA)",
1718
"website": "https://github.com/OCA/bank-payment",
1819
"category": "Banking addons",
@@ -24,7 +25,6 @@
2425
"views/account_payment_line.xml",
2526
"views/res_partner_bank_view.xml",
2627
"views/res_partner.xml",
27-
"views/bank_payment_line_view.xml",
2828
"data/mandate_reference_sequence.xml",
2929
"security/mandate_security.xml",
3030
"security/ir.model.access.csv",

account_banking_mandate/models/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@
44
from . import res_partner_bank
55
from . import res_partner
66
from . import account_payment_line
7-
from . import bank_payment_line
87
from . import account_move_line

account_banking_mandate/models/account_banking_mandate.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ def _get_default_partner_bank_id_domain(self):
4444
tracking=40,
4545
domain=lambda self: self._get_default_partner_bank_id_domain(),
4646
ondelete="restrict",
47-
index=True,
47+
index="btree",
4848
check_company=True,
4949
)
5050
partner_id = fields.Many2one(
5151
comodel_name="res.partner",
5252
related="partner_bank_id.partner_id",
5353
string="Partner",
5454
store=True,
55-
index=True,
55+
index="btree",
5656
)
5757
company_id = fields.Many2one(
5858
comodel_name="res.company",

account_banking_mandate/models/bank_payment_line.py

-23
This file was deleted.

account_banking_mandate/readme/CONTRIBUTORS.rst

+1
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@
88
* Marçal Isern <marsal.isern@qubiq.es>
99
* Andrea Stirpe <a.stirpe@onestein.nl>
1010
* Manuel Regidor <manuel.regidor@sygel.es>
11+
* Giovanni Francesco Capalbo <giovanni@therp.nl>

account_banking_mandate/static/description/index.html

+6-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
44
<head>
55
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6-
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
6+
<meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
77
<title>Account Banking Mandate</title>
88
<style type="text/css">
99

@@ -367,7 +367,7 @@ <h1 class="title">Account Banking Mandate</h1>
367367
!! This file is generated by oca-gen-addon-readme !!
368368
!! changes will be overwritten. !!
369369
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
370-
<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>
370+
<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>
371371
<p>This module adds a generic model for banking mandates.
372372
These mandates can be specialized to fit any banking mandates (such as sepa or lsv).</p>
373373
<p>A banking mandate is attached to a bank account and represents an
@@ -404,7 +404,7 @@ <h1><a class="toc-backref" href="#id3">Bug Tracker</a></h1>
404404
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/bank-payment/issues">GitHub Issues</a>.
405405
In case of trouble, please check there if your issue has already been reported.
406406
If you spotted it first, help us smashing it by providing a detailed and welcomed
407-
<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>
407+
<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>
408408
<p>Do not contact contributors directly about support or help with technical issues.</p>
409409
</div>
410410
<div class="section" id="credits">
@@ -415,6 +415,7 @@ <h2><a class="toc-backref" href="#id5">Authors</a></h2>
415415
<li>Compassion CH</li>
416416
<li>Tecnativa</li>
417417
<li>Akretion</li>
418+
<li>Therp B.V.</li>
418419
</ul>
419420
</div>
420421
<div class="section" id="contributors">
@@ -430,6 +431,7 @@ <h2><a class="toc-backref" href="#id6">Contributors</a></h2>
430431
<li>Marçal Isern &lt;<a class="reference external" href="mailto:marsal.isern&#64;qubiq.es">marsal.isern&#64;qubiq.es</a>&gt;</li>
431432
<li>Andrea Stirpe &lt;<a class="reference external" href="mailto:a.stirpe&#64;onestein.nl">a.stirpe&#64;onestein.nl</a>&gt;</li>
432433
<li>Manuel Regidor &lt;<a class="reference external" href="mailto:manuel.regidor&#64;sygel.es">manuel.regidor&#64;sygel.es</a>&gt;</li>
434+
<li>Giovanni Francesco Capalbo &lt;<a class="reference external" href="mailto:giovanni&#64;therp.nl">giovanni&#64;therp.nl</a>&gt;</li>
433435
</ul>
434436
</div>
435437
<div class="section" id="maintainers">
@@ -439,7 +441,7 @@ <h2><a class="toc-backref" href="#id7">Maintainers</a></h2>
439441
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
440442
mission is to support the collaborative development of Odoo features and
441443
promote its widespread use.</p>
442-
<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>
444+
<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>
443445
<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>
444446
</div>
445447
</div>

account_banking_mandate/tests/test_invoice_mandate.py

+2-10
Original file line numberDiff line numberDiff line change
@@ -262,11 +262,7 @@ def setUp(self):
262262

263263
self.invoice_account = self.env["account.account"].search(
264264
[
265-
(
266-
"user_type_id",
267-
"=",
268-
self.env.ref("account.data_account_type_receivable").id,
269-
),
265+
("account_type", "=", "asset_receivable"),
270266
("company_id", "=", self.company.id),
271267
],
272268
limit=1,
@@ -275,11 +271,7 @@ def setUp(self):
275271
self.env["account.account"]
276272
.search(
277273
[
278-
(
279-
"user_type_id",
280-
"=",
281-
self.env.ref("account.data_account_type_expenses").id,
282-
),
274+
("account_type", "=", "expense"),
283275
("company_id", "=", self.company.id),
284276
],
285277
limit=1,

account_banking_mandate/tests/test_mandate.py

+33-93
Original file line numberDiff line numberDiff line change
@@ -9,115 +9,64 @@
99

1010

1111
class TestMandate(TransactionCase):
12-
def test_mandate_01(self):
13-
bank_account = self.env.ref("account_payment_mode.res_partner_12_iban")
14-
mandate = self.env["account.banking.mandate"].create(
12+
def setUp(self):
13+
super(TestMandate, self).setUp()
14+
self.company = self.env.company
15+
self.company_2 = self.env["res.company"].create({"name": "company 2"})
16+
self.company_2.partner_id.company_id = self.company_2.id
17+
self.bank_account = self.env.ref("account_payment_mode.res_partner_12_iban")
18+
self.bank_account.partner_id.company_id = self.company.id
19+
self.mandate = self.env["account.banking.mandate"].create(
1520
{
16-
"partner_bank_id": bank_account.id,
21+
"partner_bank_id": self.bank_account.id,
1722
"signature_date": "2015-01-01",
1823
"company_id": self.company.id,
1924
}
2025
)
21-
self.assertEqual(mandate.state, "draft")
22-
mandate.validate()
23-
self.assertEqual(mandate.state, "valid")
24-
mandate.cancel()
25-
self.assertEqual(mandate.state, "cancel")
26-
mandate.back2draft()
27-
self.assertEqual(mandate.state, "draft")
26+
27+
def test_mandate_01(self):
28+
self.assertEqual(self.mandate.state, "draft")
29+
self.mandate.validate()
30+
self.assertEqual(self.mandate.state, "valid")
31+
self.mandate.cancel()
32+
self.assertEqual(self.mandate.state, "cancel")
33+
self.mandate.back2draft()
34+
self.assertEqual(self.mandate.state, "draft")
2835

2936
def test_mandate_02(self):
30-
bank_account = self.env.ref("account_payment_mode.res_partner_12_iban")
31-
mandate = self.env["account.banking.mandate"].create(
32-
{
33-
"partner_bank_id": bank_account.id,
34-
"signature_date": "2015-01-01",
35-
"company_id": self.company.id,
36-
}
37-
)
3837
with self.assertRaises(UserError):
39-
mandate.back2draft()
38+
self.mandate.back2draft()
4039

4140
def test_mandate_03(self):
42-
bank_account = self.env.ref("account_payment_mode.res_partner_12_iban")
43-
mandate = self.env["account.banking.mandate"].create(
44-
{
45-
"partner_bank_id": bank_account.id,
46-
"signature_date": "2015-01-01",
47-
"company_id": self.company.id,
48-
}
49-
)
50-
mandate.validate()
51-
41+
self.mandate.validate()
5242
with self.assertRaises(UserError):
53-
mandate.validate()
43+
self.mandate.validate()
5444

5545
def test_mandate_04(self):
56-
bank_account = self.env.ref("account_payment_mode.res_partner_12_iban")
57-
mandate = self.env["account.banking.mandate"].create(
58-
{
59-
"partner_bank_id": bank_account.id,
60-
"signature_date": "2015-01-01",
61-
"company_id": self.company.id,
62-
}
63-
)
64-
mandate.validate()
65-
mandate.cancel()
46+
self.mandate.validate()
47+
self.mandate.cancel()
6648
with self.assertRaises(UserError):
67-
mandate.cancel()
49+
self.mandate.cancel()
6850

6951
def test_onchange_methods(self):
70-
bank_account = self.env.ref("account_payment_mode.res_partner_12_iban")
71-
mandate = self.env["account.banking.mandate"].new(
72-
{
73-
"partner_bank_id": bank_account.id,
74-
"signature_date": "2015-01-01",
75-
"company_id": self.company.id,
76-
}
77-
)
7852
bank_account_2 = self.env.ref("account_payment_mode.res_partner_2_iban")
79-
mandate.partner_bank_id = bank_account_2
80-
mandate.mandate_partner_bank_change()
81-
self.assertEqual(mandate.partner_id, bank_account_2.partner_id)
53+
self.mandate.partner_bank_id = bank_account_2
54+
self.mandate.mandate_partner_bank_change()
55+
self.assertEqual(self.mandate.partner_id, bank_account_2.partner_id)
8256

8357
def test_constrains_01(self):
84-
bank_account = self.env.ref("account_payment_mode.res_partner_12_iban")
85-
mandate = self.env["account.banking.mandate"].create(
86-
{
87-
"partner_bank_id": bank_account.id,
88-
"signature_date": "2015-01-01",
89-
"company_id": self.company.id,
90-
}
91-
)
92-
mandate.validate()
58+
self.mandate.validate()
9359
with self.assertRaises(ValidationError):
94-
mandate.signature_date = fields.Date.to_string(
95-
fields.Date.from_string(fields.Date.context_today(mandate))
60+
self.mandate.signature_date = fields.Date.to_string(
61+
fields.Date.from_string(fields.Date.context_today(self.mandate))
9662
+ timedelta(days=1)
9763
)
9864

9965
def test_constrains_02(self):
100-
bank_account = self.env.ref("account_payment_mode.res_partner_12_iban")
101-
mandate = self.env["account.banking.mandate"].create(
102-
{
103-
"partner_bank_id": bank_account.id,
104-
"signature_date": "2015-01-01",
105-
"company_id": self.company.id,
106-
}
107-
)
108-
10966
with self.assertRaises(UserError):
110-
mandate.company_id = self.company_2
67+
self.mandate.company_id = self.company_2
11168

11269
def test_constrains_03(self):
113-
bank_account = self.env.ref("account_payment_mode.res_partner_12_iban")
114-
mandate = self.env["account.banking.mandate"].create(
115-
{
116-
"partner_bank_id": bank_account.id,
117-
"signature_date": "2015-01-01",
118-
"company_id": self.company.id,
119-
}
120-
)
12170
bank_account_2 = self.env["res.partner.bank"].create(
12271
{
12372
"acc_number": "1234",
@@ -126,7 +75,7 @@ def test_constrains_03(self):
12675
}
12776
)
12877
with self.assertRaises(UserError):
129-
mandate.partner_bank_id = bank_account_2
78+
self.mandate.partner_bank_id = bank_account_2
13079

13180
def test_constrains_04(self):
13281
mandate = self.env["account.banking.mandate"].create(
@@ -140,7 +89,7 @@ def test_constrains_04(self):
14089
}
14190
)
14291
with self.assertRaises(UserError):
143-
bank_account.mandate_ids += mandate
92+
bank_account.write({"mandate_ids": [(6, 0, mandate.ids)]})
14493

14594
def test_mandate_reference_01(self):
14695
"""
@@ -222,12 +171,3 @@ def test_mandate_reference_06(self):
222171
}
223172
)
224173
self.assertTrue(mandate.unique_mandate_reference)
225-
226-
def setUp(self):
227-
res = super(TestMandate, self).setUp()
228-
# Company
229-
self.company = self.env.ref("base.main_company")
230-
231-
# Company 2
232-
self.company_2 = self.env["res.company"].create({"name": "Company 2"})
233-
return res

0 commit comments

Comments
 (0)