Skip to content

Commit dc8a769

Browse files
Alexis de LattreCarlosRoca13
Alexis de Lattre
authored andcommitted
[MIG] account_banking_sepa_credit_transfer to v14.0
1 parent e7373c9 commit dc8a769

8 files changed

+41
-39
lines changed

account_banking_sepa_credit_transfer/__manifest__.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
# Copyright 2010-2016 Akretion (www.akretion.com)
2-
# Copyright 2016 Tecnativa - Antonio Espinosa
3-
# Copyright 2014-2018 Tecnativa - Pedro M. Baeza
1+
# Copyright 2010-2020 Akretion (www.akretion.com)
2+
# Copyright 2016-2020 Tecnativa - Antonio Espinosa and Pedro M. Baeza
43
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)
54

65
{
76
"name": "Account Banking SEPA Credit Transfer",
87
"summary": "Create SEPA XML files for Credit Transfers",
9-
"version": "13.0.1.0.0",
8+
"version": "14.0.1.0.0",
109
"license": "AGPL-3",
1110
"author": "Akretion, " "Tecnativa, " "Odoo Community Association (OCA)",
1211
"website": "https://github.com/OCA/bank-payment",
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
<?xml version="1.0" encoding="utf-8" ?>
22
<odoo noupdate="1">
3+
34
<record id="payment_mode_outbound_sepa_ct1" model="account.payment.mode">
45
<field name="name">SEPA Credit Transfer to suppliers</field>
56
<field name="company_id" ref="base.main_company" />
67
<field name="bank_account_link">variable</field>
78
<field name="payment_method_id" ref="sepa_credit_transfer" />
8-
<field
9-
name="default_journal_ids"
10-
search="[('type', 'in', ('purchase', 'purchase_refund'))]"
11-
/>
9+
<field name="default_journal_ids" search="[('type', '=', 'purchase')]" />
1210
</record>
13-
<!-- Camptocamp -->
11+
12+
<!-- Azure Interior -->
1413
<record id="base.res_partner_12" model="res.partner">
1514
<field name="supplier_payment_mode_id" ref="payment_mode_outbound_sepa_ct1" />
1615
</record>
17-
<!-- Asustek -->
16+
17+
<!-- Wood Corner -->
1818
<record id="base.res_partner_1" model="res.partner">
1919
<field name="supplier_payment_mode_id" ref="payment_mode_outbound_sepa_ct1" />
20-
</record>
20+
</record>
21+
2122
</odoo>

account_banking_sepa_credit_transfer/models/account_payment_line.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2017 Akretion - Alexis de Lattre <alexis.delattre@akretion.com>
1+
# Copyright 2017-2020 Akretion - Alexis de Lattre <alexis.delattre@akretion.com>
22
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
33

44
from odoo import fields, models
@@ -11,4 +11,7 @@ class AccountPaymentLine(models.Model):
1111
# which will begin on November 21st 2017, cf
1212
# https://www.europeanpaymentscouncil.eu/document-library/
1313
# rulebooks/2017-sepa-instant-credit-transfer-rulebook
14-
local_instrument = fields.Selection(selection_add=[("INST", "Instant Transfer")])
14+
local_instrument = fields.Selection(
15+
selection_add=[("INST", "Instant Transfer")],
16+
ondelete={"INST": "set null"},
17+
)

account_banking_sepa_credit_transfer/models/account_payment_method.py

+10-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
1+
# Copyright 2016-2020 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
22
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
33

44
from odoo import fields, models
@@ -14,7 +14,14 @@ class AccountPaymentMethod(models.Model):
1414
("pain.001.001.04", "pain.001.001.04"),
1515
("pain.001.001.05", "pain.001.001.05"),
1616
("pain.001.003.03", "pain.001.003.03 (credit transfer in Germany)"),
17-
]
17+
],
18+
ondelete={
19+
"pain.001.001.02": "set null",
20+
"pain.001.001.03": "set null",
21+
"pain.001.001.04": "set null",
22+
"pain.001.001.05": "set null",
23+
"pain.001.003.03": "set null",
24+
},
1825
)
1926

2027
def get_xsd_file_path(self):
@@ -30,4 +37,4 @@ def get_xsd_file_path(self):
3037
"account_banking_sepa_credit_transfer/data/%s.xsd" % self.pain_version
3138
)
3239
return path
33-
return super(AccountPaymentMethod, self).get_xsd_file_path()
40+
return super().get_xsd_file_path()

account_banking_sepa_credit_transfer/models/account_payment_order.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# Copyright 2010-2016 Akretion (www.akretion.com)
2-
# Copyright 2014-2018 Tecnativa - Pedro M. Baeza
1+
# Copyright 2010-2020 Akretion (www.akretion.com)
2+
# Copyright 2014-2020 Tecnativa - Pedro M. Baeza
33
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
44

55
from lxml import etree
@@ -15,7 +15,7 @@ def generate_payment_file(self): # noqa: C901
1515
"""Creates the SEPA Credit Transfer file. That's the important code!"""
1616
self.ensure_one()
1717
if self.payment_method_id.code != "sepa_credit_transfer":
18-
return super(AccountPaymentOrder, self).generate_payment_file()
18+
return super().generate_payment_file()
1919

2020
pain_flavor = self.payment_method_id.pain_version
2121
# We use pain_flavor.startswith('pain.001.001.xx')

account_banking_sepa_credit_transfer/post_install.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
1+
# Copyright 2016-2020 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
22
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
33

44
from odoo import SUPERUSER_ID, api
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
In the menu *Invoicing/Accounting > Payments > Payment Order*, create a new
1+
In the menu *Invoicing/Accounting > Vendors > Payment Orders*, create a new
22
payment order and select the Payment Mode dedicated to SEPA Credit
33
Transfer that you created during the configuration step.

account_banking_sepa_credit_transfer/tests/test_sct.py

+10-18
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ def setUpClass(cls):
6161
"reconcile": True,
6262
}
6363
)
64-
(cls.partner_asus + cls.partner_c2c + cls.partner_agrolait).with_context(
65-
force_company=cls.main_company.id
64+
(cls.partner_asus + cls.partner_c2c + cls.partner_agrolait).with_company(
65+
cls.main_company.id
6666
).write({"property_account_payable_id": cls.account_payable.id})
6767
cls.general_journal = cls.journal_model.create(
6868
{
@@ -184,9 +184,7 @@ def check_eur_currency_sct(self):
184184
agrolait_pay_line1 = pay_lines[0]
185185
accpre = self.env["decimal.precision"].precision_get("Account")
186186
self.assertEqual(agrolait_pay_line1.currency_id, self.eur_currency)
187-
self.assertEqual(
188-
agrolait_pay_line1.partner_bank_id, invoice1.invoice_partner_bank_id
189-
)
187+
self.assertEqual(agrolait_pay_line1.partner_bank_id, invoice1.partner_bank_id)
190188
self.assertEqual(
191189
float_compare(
192190
agrolait_pay_line1.amount_currency, 42, precision_digits=accpre
@@ -212,9 +210,7 @@ def check_eur_currency_sct(self):
212210
)
213211
self.assertEqual(agrolait_bank_line.communication_type, "normal")
214212
self.assertEqual(agrolait_bank_line.communication, "F1341-F1342-A1301")
215-
self.assertEqual(
216-
agrolait_bank_line.partner_bank_id, invoice1.invoice_partner_bank_id
217-
)
213+
self.assertEqual(agrolait_bank_line.partner_bank_id, invoice1.partner_bank_id)
218214

219215
action = self.payment_order.open2generated()
220216
self.assertEqual(self.payment_order.state, "generated")
@@ -281,9 +277,7 @@ def test_usd_currency_sct(self):
281277
asus_pay_line1 = pay_lines[0]
282278
accpre = self.env["decimal.precision"].precision_get("Account")
283279
self.assertEqual(asus_pay_line1.currency_id, self.usd_currency)
284-
self.assertEqual(
285-
asus_pay_line1.partner_bank_id, invoice1.invoice_partner_bank_id
286-
)
280+
self.assertEqual(asus_pay_line1.partner_bank_id, invoice1.partner_bank_id)
287281
self.assertEqual(
288282
float_compare(
289283
asus_pay_line1.amount_currency, 2042, precision_digits=accpre
@@ -309,9 +303,7 @@ def test_usd_currency_sct(self):
309303
)
310304
self.assertEqual(asus_bank_line.communication_type, "normal")
311305
self.assertEqual(asus_bank_line.communication, "Inv9032-Inv9033")
312-
self.assertEqual(
313-
asus_bank_line.partner_bank_id, invoice1.invoice_partner_bank_id
314-
)
306+
self.assertEqual(asus_bank_line.partner_bank_id, invoice1.partner_bank_id)
315307

316308
action = self.payment_order.open2generated()
317309
self.assertEqual(self.payment_order.state, "generated")
@@ -354,17 +346,17 @@ def create_invoice(
354346
currency_id,
355347
price_unit,
356348
reference,
357-
type="in_invoice",
349+
move_type="in_invoice",
358350
):
359351
data = {
360352
"partner_id": partner_id,
361353
"reference_type": "none",
362354
"ref": reference,
363355
"currency_id": currency_id,
364356
"invoice_date": time.strftime("%Y-%m-%d"),
365-
"type": type,
357+
"move_type": move_type,
366358
"payment_mode_id": cls.payment_mode.id,
367-
"invoice_partner_bank_id": cls.env.ref(partner_bank_xmlid).id,
359+
"partner_bank_id": cls.env.ref(partner_bank_xmlid).id,
368360
"invoice_line_ids": [],
369361
}
370362
line_data = {
@@ -375,5 +367,5 @@ def create_invoice(
375367
}
376368
data["invoice_line_ids"].append((0, 0, line_data))
377369
inv = cls.env["account.move"].create(data)
378-
inv.post()
370+
inv.action_post()
379371
return inv

0 commit comments

Comments
 (0)