[MIG] account_banking_sepa_credit_transfer to v14.0

This commit is contained in:
Alexis de Lattre
2021-01-13 08:49:21 +01:00
committed by Carlos Roca
parent e7373c9f5e
commit dc8a769aaf
8 changed files with 41 additions and 39 deletions

View File

@@ -1,12 +1,11 @@
# Copyright 2010-2016 Akretion (www.akretion.com)
# Copyright 2016 Tecnativa - Antonio Espinosa
# Copyright 2014-2018 Tecnativa - Pedro M. Baeza
# Copyright 2010-2020 Akretion (www.akretion.com)
# Copyright 2016-2020 Tecnativa - Antonio Espinosa and Pedro M. Baeza
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)
{
"name": "Account Banking SEPA Credit Transfer",
"summary": "Create SEPA XML files for Credit Transfers",
"version": "13.0.1.0.0",
"version": "14.0.1.0.0",
"license": "AGPL-3",
"author": "Akretion, " "Tecnativa, " "Odoo Community Association (OCA)",
"website": "https://github.com/OCA/bank-payment",

View File

@@ -1,21 +1,22 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">
<record id="payment_mode_outbound_sepa_ct1" model="account.payment.mode">
<field name="name">SEPA Credit Transfer to suppliers</field>
<field name="company_id" ref="base.main_company" />
<field name="bank_account_link">variable</field>
<field name="payment_method_id" ref="sepa_credit_transfer" />
<field
name="default_journal_ids"
search="[('type', 'in', ('purchase', 'purchase_refund'))]"
/>
<field name="default_journal_ids" search="[('type', '=', 'purchase')]" />
</record>
<!-- Camptocamp -->
<!-- Azure Interior -->
<record id="base.res_partner_12" model="res.partner">
<field name="supplier_payment_mode_id" ref="payment_mode_outbound_sepa_ct1" />
</record>
<!-- Asustek -->
<!-- Wood Corner -->
<record id="base.res_partner_1" model="res.partner">
<field name="supplier_payment_mode_id" ref="payment_mode_outbound_sepa_ct1" />
</record>
</record>
</odoo>

View File

@@ -1,4 +1,4 @@
# Copyright 2017 Akretion - Alexis de Lattre <alexis.delattre@akretion.com>
# Copyright 2017-2020 Akretion - Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import fields, models
@@ -11,4 +11,7 @@ class AccountPaymentLine(models.Model):
# which will begin on November 21st 2017, cf
# https://www.europeanpaymentscouncil.eu/document-library/
# rulebooks/2017-sepa-instant-credit-transfer-rulebook
local_instrument = fields.Selection(selection_add=[("INST", "Instant Transfer")])
local_instrument = fields.Selection(
selection_add=[("INST", "Instant Transfer")],
ondelete={"INST": "set null"},
)

View File

@@ -1,4 +1,4 @@
# Copyright 2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
# Copyright 2016-2020 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import fields, models
@@ -14,7 +14,14 @@ class AccountPaymentMethod(models.Model):
("pain.001.001.04", "pain.001.001.04"),
("pain.001.001.05", "pain.001.001.05"),
("pain.001.003.03", "pain.001.003.03 (credit transfer in Germany)"),
]
],
ondelete={
"pain.001.001.02": "set null",
"pain.001.001.03": "set null",
"pain.001.001.04": "set null",
"pain.001.001.05": "set null",
"pain.001.003.03": "set null",
},
)
def get_xsd_file_path(self):
@@ -30,4 +37,4 @@ class AccountPaymentMethod(models.Model):
"account_banking_sepa_credit_transfer/data/%s.xsd" % self.pain_version
)
return path
return super(AccountPaymentMethod, self).get_xsd_file_path()
return super().get_xsd_file_path()

View File

@@ -1,5 +1,5 @@
# Copyright 2010-2016 Akretion (www.akretion.com)
# Copyright 2014-2018 Tecnativa - Pedro M. Baeza
# Copyright 2010-2020 Akretion (www.akretion.com)
# Copyright 2014-2020 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from lxml import etree
@@ -15,7 +15,7 @@ class AccountPaymentOrder(models.Model):
"""Creates the SEPA Credit Transfer file. That's the important code!"""
self.ensure_one()
if self.payment_method_id.code != "sepa_credit_transfer":
return super(AccountPaymentOrder, self).generate_payment_file()
return super().generate_payment_file()
pain_flavor = self.payment_method_id.pain_version
# We use pain_flavor.startswith('pain.001.001.xx')

View File

@@ -1,4 +1,4 @@
# Copyright 2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
# Copyright 2016-2020 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import SUPERUSER_ID, api

View File

@@ -1,3 +1,3 @@
In the menu *Invoicing/Accounting > Payments > Payment Order*, create a new
In the menu *Invoicing/Accounting > Vendors > Payment Orders*, create a new
payment order and select the Payment Mode dedicated to SEPA Credit
Transfer that you created during the configuration step.

View File

@@ -61,8 +61,8 @@ class TestSCT(SavepointCase):
"reconcile": True,
}
)
(cls.partner_asus + cls.partner_c2c + cls.partner_agrolait).with_context(
force_company=cls.main_company.id
(cls.partner_asus + cls.partner_c2c + cls.partner_agrolait).with_company(
cls.main_company.id
).write({"property_account_payable_id": cls.account_payable.id})
cls.general_journal = cls.journal_model.create(
{
@@ -184,9 +184,7 @@ class TestSCT(SavepointCase):
agrolait_pay_line1 = pay_lines[0]
accpre = self.env["decimal.precision"].precision_get("Account")
self.assertEqual(agrolait_pay_line1.currency_id, self.eur_currency)
self.assertEqual(
agrolait_pay_line1.partner_bank_id, invoice1.invoice_partner_bank_id
)
self.assertEqual(agrolait_pay_line1.partner_bank_id, invoice1.partner_bank_id)
self.assertEqual(
float_compare(
agrolait_pay_line1.amount_currency, 42, precision_digits=accpre
@@ -212,9 +210,7 @@ class TestSCT(SavepointCase):
)
self.assertEqual(agrolait_bank_line.communication_type, "normal")
self.assertEqual(agrolait_bank_line.communication, "F1341-F1342-A1301")
self.assertEqual(
agrolait_bank_line.partner_bank_id, invoice1.invoice_partner_bank_id
)
self.assertEqual(agrolait_bank_line.partner_bank_id, invoice1.partner_bank_id)
action = self.payment_order.open2generated()
self.assertEqual(self.payment_order.state, "generated")
@@ -281,9 +277,7 @@ class TestSCT(SavepointCase):
asus_pay_line1 = pay_lines[0]
accpre = self.env["decimal.precision"].precision_get("Account")
self.assertEqual(asus_pay_line1.currency_id, self.usd_currency)
self.assertEqual(
asus_pay_line1.partner_bank_id, invoice1.invoice_partner_bank_id
)
self.assertEqual(asus_pay_line1.partner_bank_id, invoice1.partner_bank_id)
self.assertEqual(
float_compare(
asus_pay_line1.amount_currency, 2042, precision_digits=accpre
@@ -309,9 +303,7 @@ class TestSCT(SavepointCase):
)
self.assertEqual(asus_bank_line.communication_type, "normal")
self.assertEqual(asus_bank_line.communication, "Inv9032-Inv9033")
self.assertEqual(
asus_bank_line.partner_bank_id, invoice1.invoice_partner_bank_id
)
self.assertEqual(asus_bank_line.partner_bank_id, invoice1.partner_bank_id)
action = self.payment_order.open2generated()
self.assertEqual(self.payment_order.state, "generated")
@@ -354,7 +346,7 @@ class TestSCT(SavepointCase):
currency_id,
price_unit,
reference,
type="in_invoice",
move_type="in_invoice",
):
data = {
"partner_id": partner_id,
@@ -362,9 +354,9 @@ class TestSCT(SavepointCase):
"ref": reference,
"currency_id": currency_id,
"invoice_date": time.strftime("%Y-%m-%d"),
"type": type,
"move_type": move_type,
"payment_mode_id": cls.payment_mode.id,
"invoice_partner_bank_id": cls.env.ref(partner_bank_xmlid).id,
"partner_bank_id": cls.env.ref(partner_bank_xmlid).id,
"invoice_line_ids": [],
}
line_data = {
@@ -375,5 +367,5 @@ class TestSCT(SavepointCase):
}
data["invoice_line_ids"].append((0, 0, line_data))
inv = cls.env["account.move"].create(data)
inv.post()
inv.action_post()
return inv